code_junkie

grep --exclude/--include syntax (do not grep through certain files)

Nov 11th, 2011
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. grep -ircl "foo=" *
  2.  
  3. --include=PATTERN Recurse in directories only searching file matching PATTERN.
  4. --exclude=PATTERN Recurse in directories skip file matching PATTERN.
  5.  
  6. grep -ircl --exclude=*.{png,jpg} "foo=" *
  7.  
  8. grep -Ir --exclude="*.svn*" "pattern" *
  9.  
  10. grep pattern -r --include=*.{cpp,h} rootdir
  11.  
  12. grep -rI --exclude-dir=".svn" "pattern" *
  13.  
  14. grep -ircl --exclude=*.{png,jpg} "foo=" *
  15.  
  16. ack -icl "foo="
  17.  
  18. ack -icl --cpp "foo="
  19.  
  20. export GREP_OPTIONS="--exclude=*.svn*"
  21.  
  22. grep -Ir --exclude="*.svn*" "pattern" *
  23.  
  24. grep -rn "foo=" . | grep -v "Binary file"
  25.  
  26. find . -not -name '*.png' -o -type f -print | xargs grep -icl "foo="
  27.  
  28. export GREP_OPTIONS="--exclude-dir=\*/.svn/\* --exclude=\*~"
  29.  
  30. export GREP_OPTIONS="--exclude-dir=\*/.svn/\* --exclude=\*~"
  31.  
  32. du -ha | grep -i -o "./.*" | grep -v ".svn|another_file|another_folder" | xargs grep -i -n "$1"
  33.  
  34. sudo port install grep
Add Comment
Please, Sign In to add comment