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 namef[something].dat
.
if want check files in directory, can useful:
grep -l "your_string" /your/dir/