Boş satırları görmezden gelerek dosya karşılaştırmak
diff -w file1.txt file2.txt 2c2 < hscripts.com --- > HSCRIPTS.com 4d3 < Hioxindia.com
diff -y kullanarak satır satır karşılaştırma yapılabilir.
-b ile boş satırlar ihmal ediliyor
diff -by file1.txt file2.txt HIOX TEST HIOX TEST hscripts.com | HSCRIPTS.com with friend ship with friend ship Hioxindia.com <
diff -i ile case insensitive karşılaştırma yapılabilir.
diff -iy file1.txt file2.txt HIOX TEST HIOX TEST hscripts.com HSCRIPTS.com with friend ship | with friend ship Hioxindia.com <
Diff sonucunu okumak:
cat email 1 John erpl08@ed 2 Joe CZT@cern.ch 3 Kim ks@x.co 4 Keith keith@festival cat addresses 1 John erpl08@ed 2 Joe CZT@cern.ch 3 Jean JRS@pollux.ucs.co 4 Jim jim@frolix8 5 Kim ks@x.co 6 Keith keith@festival
diff email addresses 2a3,4 > Jean JRS@pollux.ucs.co > Jim jim@frolix8
To make these files match you need to add (a) lines 3 and 4 (3,4) of the file addresses (>) after line 2 in the file email.
diff cookies.old cookies.new 5c5 < One cup vanilla extract --- > One teaspoon vanilla extract 7d6 < Six ounces chopped liver 21a22 > Note: The previous version of this recipe had a few errors!
The output is actually a description of how to transform the old file into the new one. Here, diff is telling you three things:
· The fifth line of the file has undergone a change. The 5c5 message says to replace line 5 of the old file with line 5 of the new file. Both the old and new text are displayed, separated by a line of three dashes. (The less-than (<) notation means “remove this line,” and the greater-than (>) sign means “add this line.”)
· Line 7 of the old file does not appear in the new file. The 7d6 message says to delete line 7 from the old file, and the files will then be in sync, starting at line 6 of the new file. The text to be deleted is displayed on the next line.
· A line was added to the new file. The 21a22 message says to add a new line after line 21 of the old file. The text to be added is displayed on the final line of the output.
Bir cevap yazın