Grep

From Hackepedia
Revision as of 12:25, 21 October 2007 by Franks (talk | contribs) (requires optimization)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

If you want to grep for two strings? say fish OR fowl in your file:

$ egrep '(fish|fowl)' file

To show all lines that do not start with a # (commented out):

# grep -v ^# /etc/inetd.conf

If you want to search for the some string resursively through subdirectories:

$ grep . -name "*" | xargs grep "some string"

(someone please optimize the above)