Difference between revisions of "Grep"

From HalfgeekKB
Jump to navigation Jump to search
(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...")
(No difference)

Revision as of 14:38, 3 January 2015

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' {} \;