| |
|---|
| Function | Prints lines that match a pattern in a page or piped input (substring match). |
| Options | You can combine the options in the following table (for example -iv or -i -v). |
| Limitations | grep requires a pattern and either a page path or piped input. With stdin, PATH is ignored. |
| Option | Meaning |
|---|
-i | Ignore case |
-v | Show lines that don’t match |
-n | Prefix each line with its 1-based line number (N:line) |
-c | Print a count of matching lines instead of the lines |
$ grep -n pattern ./page1
$ grep -c pattern ./page1
$ cat ./page | grep -c error
Enter help grep in the console to view this option list. To search page bodies across a tree, use find … -exec grep.