❮ uniq
❯
- grep
- egrep
- ack-grep
Finding text in a file
- grep regex FILEs
- egrep regex FILEs
- ack-grep
-v lines that did not match -i ignore case -n show line numbers -r look into the files recursively -w match exact words only -l print names of the files matched -c count of lines matched -B n show n lines before the match. -A n show n lines after the match. -C n show n lines both before and after the match (up to 2*n+1 lines) (context).
examples/intro/grep.txt
$ cat examples/intro/words.txt foo foo bar foo bar $ grep bar examples/intro/words.txt bar bar $ grep -v bar examples/intro/words.txt foo foo foo $ grep -n bar examples/intro/words.txt 3:bar 5:bar $ grep -n -v bar examples/intro/words.txt 1:foo 2:foo 4:foo