Grep

From HalfgeekKB
Revision as of 13:38, 3 January 2015 by Psmay (talk | contribs) (Created page with "==grep with find== Given the common <code>grep</code> command <syntaxhighlight lang=bash> grep -R 'pattern' * </syntaxhighlight> a corresponding <code>find -exec</code> com...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

grep with find

Given the common grep command

grep -R 'pattern' *

a corresponding find -exec command should add -H to include the filename prefix in the results. (This is needed because the filenames are given one at a time.)

find … -exec grep -H -R 'pattern' {} \;