bash - How to find which file contains a string from many files in a directory? -


for example, have directory contains many files(say f1.dat, f2.dat ... , f100.dat). , want find out file contains string( string "error"). how it.

you can do:

grep -l "your_string" /your/dir/f*.dat 
  • -l list files match grep.
  • f*.dat refers files name f[something].dat.

if want check files in directory, can useful:

grep -l "your_string" /your/dir/ 

Popular posts from this blog

Php - Delimiter must not be alphanumeric or backslash -

c# - How to change the "Applies To" field under folder auditing options programatically (.NET) -

c++ - Ambiguity when using boost::assign::list_of to construct a std::vector -