Skip to content

Instantly share code, notes, and snippets.

@koki-h
Created April 19, 2018 07:53
Show Gist options
  • Select an option

  • Save koki-h/70135d5be9bfbcfa3b0e607675be9048 to your computer and use it in GitHub Desktop.

Select an option

Save koki-h/70135d5be9bfbcfa3b0e607675be9048 to your computer and use it in GitHub Desktop.
2つのディレクトリ名を受け取り、それぞれの中にある同名のファイルのdiffを取る
dir1 = ARGV[0]
dir2 = ARGV[1]
Dir.glob("#{dir1}/*").sort.each do | file |
filename = File.basename(file)
puts "#{file} vs #{dir2}/#{filename} :"
puts `sdiff -bBWs #{file} #{dir2}/#{filename}` #side-by-sideで差分のある行だけを表示
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment