Grep searches a file for occurances of a search pattern given by the user. By default all lines which contain the search pattern are displayed.
| -b | Display byte offset within each file before each line of output |
|---|---|
| -f filename | Use file filename as search pattern |
| -n | Prefix each line of output with the line number within its input file. |
Perhapes you needed to see every line in a piece of code (called myfile.c) which contained the varible test you could do the following.
grep test myfile.c
Perhaps after writting a paper you discover you misspelled dog as dig you could use the grep command to find all of the lines where you typed dig instead of dog.
grep dig termpaper.docGrep can be used for many different things in many different ways which will assist you in you work and play.