Grep: Difference between revisions

From Hackepedia
Jump to navigationJump to search
m added brackets
m requires optimization
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:


  $ egrep '(fish|fowl)' 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)

Latest revision as of 12:25, 21 October 2007

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)