GNU找到
find . -iname "*.x" -type f -exec grep -l "s" {} +;
Run Code Online (Sandbox Code Playgroud)
如果你有Ruby(1.9+)
Dir["/path/**/*.x"].each do |file|
if test(?f,file)
open(file).each do |line|
if line[/s/]
puts "file: #{file}"
break
end
end
end
end
Run Code Online (Sandbox Code Playgroud)