grep – a patternmatcher

This entry was posted by on Wednesday, 5 May, 2010 at

Article on the usefulness of grep.

Say you have a heap of files, and want to search for the occurence of ‘foo’ and ‘bar’ on the same line:

grep -Hrin foo * | grep -Hrin bar *

This will output (if found):

some_file:6: blah blah foo blah blah bar blah blah


Leave a Reply