熱搜:win11繞過硬件限制安裝 一鍵重裝Win10系統(tǒng) 最干凈的u盤啟動(dòng)盤 真正純凈版的win7系統(tǒng)
時(shí)間:2014-12-30 18:17:15 作者:qipeng 來源:系統(tǒng)之家 1. 掃描二維碼隨時(shí)看資訊 2. 請使用手機(jī)瀏覽器訪問: https://m.xitongzhijia.net/xtjc/20141230/33800.html 手機(jī)查看 評論 反饋
diff test3/log2014.log test6/log2014.log
1,12d0
《 2013-01
《 2013-02
《 2014-03
《 2013-04
《 2013-05
《 2013-06
《 2013-07
《 2013-07
《 2013-09
《 2013-10
《 2013-11
《 2013-12
Only in test6: log2015.log
Only in test6: log2016.log
Only in test6: log2017.log
。踨oot@localhost test]#
實(shí)例6:比較兩個(gè)文件不同,并生產(chǎn)補(bǔ)丁
命令:diff -ruN log2013.log log2014.log 》patch.log
輸出:
代碼如下:
。踨oot@localhost test3]# diff -ruN log2013.log log2014.log 》patch.log
[root@localhost test3]# ll
總計(jì) 12
-rw-r--r-- 2 root root 80 12-07 16:36 log2013.log
-rw-r--r-- 1 root root 96 12-07 18:01 log2014.log
-rw-r--r-- 1 root root 248 12-07 21:33 patch.log
。踨oot@localhost test3]# cat patc.log
cat: patc.log: 沒有那個(gè)文件或目錄
。踨oot@localhost test3]# cat patch.log
--- log2013.log 2012-12-07 16:36:26.000000000 +0800
+++ log2014.log 2012-12-07 18:01:54.000000000 +0800
@@ -1,10 +1,12 @@
2013-01
2013-02
-2013-03
+2014-03
2013-04
2013-05
2013-06
2013-07
-2013-08
+2013-07
2013-09
2013-10
+2013-11
+2013-12[root@localhost test3]#
實(shí)例7:打補(bǔ)丁
命令: cat log2013.log
輸出:
代碼如下:
。踨oot@localhost test3]# cat log2013.log
2013-01
2013-02
2013-03
2013-04
2013-05
2013-06
2013-07
2013-08
2013-09
2013-10[root@localhost test3]# patch log2013.log patch.log
patching file log2013.log
。踨oot@localhost test3]#
。踨oot@localhost test3]# cat log2013.log
2013-01
2013-02
2014-03
2013-04
2013-05
2013-06
2013-07
2013-07
2013-09
2013-10
2013-11
2013-12[root@localhost test3]#
上面就是Linux中diff命令的用法介紹了,diff命令除了比較文件外,還可以統(tǒng)一格式輸出、給文件補(bǔ)丁、并排格式輸出的功能,是個(gè)比較重要的命令,如果你還想了解更多的命令知識(shí),不妨多多關(guān)注系統(tǒng)之家吧。
發(fā)表評論
共0條
評論就這些咯,讓大家也知道你的獨(dú)特見解
立即評論以上留言僅代表用戶個(gè)人觀點(diǎn),不代表系統(tǒng)之家立場