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

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -