shell

Grep a Glob

Submitted by Jeet Sukumaran on Sat, 10/04/2008 - 02:02

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

Syndicate content