Grep: Difference between revisions

306 bytes added ,  6 years ago
 
Line 47:
Recursive Search
grep -r "test" *
 
Recursively but ignore binary files
grep -rI "test" someDir/
 
Invert match
Line 92 ⟶ 95:
Grep from compressed files
zgrep -I "free space" ./messages*
 
Print lines which begin with "foo" and end in "bar"
grep "^foo.*bar$" file.txt
 
Filter the Filtered output:
grep "test" file.txt | grep -v "pass"
 
Search for the string and not the regex:
fgrep "foobar" file.txt
grep -F "foobar" file.txt
 
<br />