2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

2つのファイルの差分を出力するコマンド

Posted at

比較するファイル

test1.txt
あいうえお
かきくけこ
さしすせそ
たちつてと
test2.txt
あいうえお
かきくけこ
さしスせそ
たちつてと

diffコマンド

$ diff test1.txt test2.txt 
結果
3c3
< さしすせそ
---
> さしスせそ

diff -u

$ diff -u test1.txt test2.txt 

gitっぽい結果になります
unified出力形式っていうらしいです

結果
--- test1.txt	2015-11-10 23:16:06.000000000 +0900
+++ test2.txt	2015-11-10 23:16:05.000000000 +0900
@@ -1,4 +1,4 @@
 あいうえお
 かきくけこ
-さしすせそ
+さしスせそ
 たちつてと
\ No newline at end of file

その他のオプション

-b

スペースの違いは無視

-q

差分があるかどうかのみ返します

-i

大文字小文字の違いは無視

2
2
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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?