Grep: Difference between revisions

From Hackepedia
Jump to navigationJump to search
No edit summary
m requires optimization
 
Line 6: Line 6:


  # grep -v ^# /etc/inetd.conf
  # 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 11: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)