Guest User

Untitled

a guest
Jul 17th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. /usr/bin/env bash
  2.  
  3. find . -exec grep chrome {} +
  4.  
  5. #find will execute grep and will substitute {} with the filename(s) found. The difference between ; and + #is that with ; a single grep command for each file is executed whereas with + as many files as possible #are given as parameters to grep at once.
  6.  
  7.  
  8. If you use the \; ending construct grep is passed one file at a time, so it doesn't display the file name by default, only the matched lines. To get a file list instead add use grep -ls inside of the find construct.
  9.  
  10. find . -exec grep foo {} + will show you output like this ./dir/file.py:from foo import bar – s g Apr 17 '15 at 20:30
  11.  
  12. find . -exec grep foo {} \; will show you output like this from foo import bar – s g Apr 17 '15 at 20:31
  13.  
  14. find . -exec grep -l foo {} + will show you output like this ./dir/file.py – s g Apr 17 '15 at 20:32
  15.  
  16. find . -exec grep -l foo {} \; will show you output like this ./dir/file.py – s g Apr 17 '15 at 20:33
Add Comment
Please, Sign In to add comment