User Tools

Site Tools


grep_on_find_results

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
grep_on_find_results [2021/04/08 10:26] rajugrep_on_find_results [2021/04/08 10:30] (current) raju
Line 4: Line 4:
 </code> </code>
  
-The output can be redirected to a file+Another solution is to use xargs
 <code> <code>
-find . -iname '*.py' -exec grep something -inH --color {} + > output.txt+find . -iname '*.py' -print0 | xargs -0 grep something -inH --color
 </code> </code>
  
-Another solution is to use xargs+The output can be redirected to a file
 <code> <code>
-find . -iname '*.py' -print0 | xargs -0 grep something -inH --color+find . -iname '*.py' -exec grep something -inH --color {} + > output.txt
 </code> </code>
  
-From the man page of find:+Notes: 
 + 
 +Here is an excerpt from the man page of find (https://man7.org/linux/man-pages/man1/find.1.html -> search for "-exec command {} +") 
 <code> <code>
        -exec command {} +        -exec command {} +
Line 38: Line 41:
 </code> </code>
  
-Ref:- https://man7.org/linux/man-pages/man1/find.1.html -> search for "-exec command {} +" 
grep_on_find_results.1617877574.txt.gz · Last modified: 2021/04/08 10:26 by raju