Why grep is used? options of grep

Why grep is used? options of grep
Search for the occurence of a pattern in a file: grep 'pattern' file. If one just wants to know how often soemthing occurs in a file, then: grep -c 'pattern file. This can be used in a script like:
if [[ $(grep -c 'pattern' file) != 0 ]];then ......;fi. The condition is fullfilled if the pattern was found.
Grep Options
SYNTAX
grep "Search String" [filename]
grep [-e pattern] [file...]
grep [-f file] [file...]

No comments:

 
Top Blogs