Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 4th, 2013  |  syntax: None  |  size: 0.27 KB  |  views: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. % comment
  2. filename1 pattern-to-search1
  3. filename1 pattern-to-search2
  4. ...
  5.        
  6. while read file p
  7. do
  8.     if [ "${file:0:1}" != "%" ]
  9.     then
  10.     grep -o "$p" $file | wc -l
  11.     fi
  12. done
  13. echo -e "nDone."
  14.        
  15. grep -v '^%' | while read file p
  16. do
  17.     grep -c "$p" -- "$file"
  18. done