shell

Posted by Jeet Sukumaran

Here are three confessions:

Grep a Glob

04 Oct 2008
Posted by Jeet Sukumaran

Ever wanted to search a group of files, as specified by a glob pattern, for some content, as specified by a grep pattern?

find -path '' -exec grep -iHn {} \;

Note that the GLOB-PATTERN should be quoted to prevent the shell from auto-expanding wildcards before passing them to find.

Examples:

find /Applications -path "*.app/Contents/Info.plist" -exec grep -iH python {} \;