まだ目grepで消耗してるの?テキストファイルの比較で?gitの差分みたいな Linuxのdiffコマンド使ってる?
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
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 /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
$ 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が多いことが分かる
Author And Source
この問題について(まだ目grepで消耗してるの?テキストファイルの比較で?gitの差分みたいな Linuxのdiffコマンド使ってる?), 我々は、より多くの情報をここで見つけました https://qiita.com/YumaInaura/items/c32c9c5c2df0bcb74f4f著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .