Description
grep searches the named input FILEs (or standard input if no files are named, or if a single dash ("-") is given as the file name) for lines containing a match to the given PATTERN. By default, grep prints the matching lines.
In addition, three variant programs egrep, fgrep and rgrep are available:
egrep is the same as grep -E.
fgrep is the same as grep -F.
rgrep is the same as grep -r.
Search 2 different words by using grep:
$ egrep -w 'word1|word2' /path/to/file
search more words by using below commands
ls -lrt | grep -ir "fillter\|new\|php"
Options in the grep;
^ – beginning of the line
c – letter c
c – letter c
: – colon
$ – end of line
v, --invert-match Invert the sense of matching, to select non-matching lines
-y The same as -i.
No comments:
Post a Comment