LoginSignup
4
0

More than 3 years have passed since last update.

CSV ファイルの差分(git diff 利用)

Last updated at Posted at 2020-06-04

こんにちは。
二つの CSV ファイル内の値の差を調べるために、git diff を用いてみました。色付き出力を指定しています。

$ git --no-pager diff --color --word-diff-regex="[^,]+" 1.csv 2.csv
diff --git a/1.csv b/2.csv
index a84bde8..9a2c7e4 100644
--- a/1.csv
+++ b/2.csv
@@ -1 +1 @@
1,2,[-3.4,5-]{+3.5,6+},7
$
$ cat 1.csv 2.csv
1,2,3.4,5,7
1,2,3.5,6,7
$

また上記の色付き出力を html ファイル化しました(aha コマンド利用)。

$ git --no-pager diff --color --word-diff-regex="[^,]+" 1.csv 2.csv | aha --title 1_vs_2 > 1_vs_2.html
4
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
0