If you don't care about the rest of the output, then
yourcommand | grep "some regular expression"
will only print the lines that contain "some regular expression".
yourcommand | less
will send the output of your command to the less
command which lets you scroll up and down the output. You can search by typing /some regular expression
and pressing enter. q
will close the program.
If you do want to save the file, then
yourcommand > outputfile
will send the output to a file instead of the screen, which you can open in an editor and search instead of displaying it on the screen. If it exists, outputfile
will be erased before yourcommand runs. You can add the output to the end of an existing file if you use >>
instead.
The tee
program lets you save the output to a file and send it to another program at the same time:
yourcommand | tee outputfile | somethingelse
This will save the original output to outputfile
and pass it to some other command.