Grep

From Hackepedia
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)