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
Post a Comment