EnderUNIX Team.

EnderUNIX tips

Mail to My Friend , Home Page

[ Linux ]

"Search for a string in files and then list the file names" - Mehmet Uluer - (2013-04-26 11:29:39)   [13255]

# find /tmp/ -type f -name '*txt' -exec grep -l 'string' {} ;

Look at all files and sub directories in /tmp
Look for only regular files (eg. not binaries)
Look for the files ending with "txt"
Look into the specific file found by find if it contains the string "string",
If so, list the file name,

Look at this tip if you need xargs version:

Mail to My Friend , Home Page