Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I see many grep results page by page?

Tags:

grep

I am new to Linux. If I use grep and there are so many results that they cannot all be displayed at once, how can I view the results page by page, so that I get a chance to see them all without missing any?

like image 289
kiki Avatar asked Dec 01 '10 06:12

kiki


People also ask

How do I count grep results?

Using grep -c alone will count the number of lines that contain the matching word instead of the number of total matches. The -o option is what tells grep to output each match in a unique line and then wc -l tells wc to count the number of lines. This is how the total number of matching words is deduced.

How do I print 10 lines after grep?

You can use grep with -A n option to print N lines after matching lines. Using -B n option you can print N lines before matching lines. Using -C n option you can print N lines before and after matching lines.

Can you pipe grep to grep?

1 grep as a Filter. grep is very often used as a "filter" with other commands. It allows you to filter out useless information from the output of commands. To use grep as a filter, you must pipe the output of the command through grep .


1 Answers

try

grep YOUR_PATTERN_AND_OPTION YOUR_PATH | less 

or

grep YOUR_PATTERN_AND_OPTION YOUR_PATH | more 
like image 57
ajreal Avatar answered Sep 24 '22 02:09

ajreal