February 2001
Beginner to intermediate
448 pages
9h 2m
English
Official Description
Searches a file for patterns.
Syntax
grep [-E | -F] [-c | -l | -q] [-bhinsvwxy] [-pparagraph_separator] –e pattern_list [-e pattern_list]... [-f pattern_file]... [file...]
Options
-E functions as an egrep command.
-F functions as an fgrep command.
-c shows a count of matching lines.
-i ignores case.
-l lists filenames.
-v inverts the meaning of the search.
Oddities
The grep command looks to stdin for the data through which to search.
Example
$ cat buzz #! /bin/ksh integer x=17 while : do x=17 done $ $ cat buzz | grep 17 # Looks through piped data for 17 integer x=17 x=17 $ ls | grep buzz # Looks through piped data for buzz buzz buzz1 buzz2 buzz3 buzz4 $ ls | grep 17 # Looks through piped data for 17, not there $ $ ...
Read now
Unlock full access