linux - Can I use grep to find a file including a particular string? -


can use grep find file including particular string? example, find file containing "abc" without knowing file name.

grep -l "abc" * 

if want recursive ,

grep -r -l "abc" * 

if have ruby(1.9+)

dir["**/*"].each |file|   if test(?f,file)    open(file).each |line|      if line[/abc/]        puts "line: #{line}"        puts "file: #{file}"      end    end   end end 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -