diff
diff data1.txt data2.txt
And when used normally
--- data1.txt
+++ data2.txt
@@ -1,4 +1,4 @@
11111
-22222
+22225
33333
-44444
+44445
Lines with the same content and lines with different contents are displayed as a mixture. I thought it was a little hard to see when there were many lines.
sed The beginning of the same line is blank, so filter (delete) with sed.
sed -e '/^ .\+/d'
"^" ". \ +" Starting with a space means to delete any character string with d.
Connect with diff with a pipe.
diff data1.txt data2.txt | sed -e '/^ .\+/d'
Then
--- data1.txt
+++ data2.txt
@@ -1,4 +1,4 @@
-22222
+22225
-44444
+44445
It was refreshing with only different lines.
Recently I've been studying shells using busybox on Windows, but it's deep.
Recommended Posts