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

delphi - TJvHidDeviceController "DevicePath" always showing "\" -

Disabling Android home button for industry application -

asp.net mvc 3 - Unexpected "foreach" keyword after "@" character -