4
4

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 1 year has passed since last update.

まだ目grepで消耗してるの?テキストファイルの比較で?gitの差分みたいな Linuxのdiffコマンド使ってる?

Last updated at Posted at 2018-12-27

gitなどのコアにも使われていると勝手に@yumainauraが想像してるコマンド。

こんなテキストファイルを二個作る

text1

A
B
C

test2

B
C
D

#作成例

touch ~/tmp/text1; echo A > ~/tmp/text1; echo B > ~/tmp/text1; echo C > ~/tmp/text1;
touch ~/tmp/text2; echo B > ~/tmp/text2; echo C > ~/tmp/text2; echo D > ~/tmp/text2;

Diff!

$ diff /tmp/text1 /tmp/text2
1c1
< C
---
> D

いつも見慣れたプラスマーク、マイナスマークで出すにはこれ!

$ diff -u /tmp/text1 /tmp/text2
--- /tmp/text1	2018-12-27 19:13:19.000000000 +0900
+++ /tmp/text2	2018-12-27 19:13:34.000000000 +0900
@@ -1 +1 @@
-C
+D

Cが少なく
Dが多いことが分かる

linux yumainaura - Google Search

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

4
4
8

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
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?