2011年12月12日 星期一

diff 用法

 

指令用法: 用來比較兩個檔案的差異

#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!

24,26c31,33

< entry = https://xxx,xxx,xxx

< mail_sender = xxx@test.com

< report_banner = XXXXX.png---

 

說明:

5c5:    (c: change, 取代第五行舊的資料,取代的資料來至於新的檔案第五行)

> (great than) : 代表 add this line

<  (less than):   代表 remove this line

--- 用來隔離新舊替換的資料

7d6:  (d: delete, 代表第七行會被刪除,在新的檔案中,會變成從第六行開始

21a22:    (a:  add this line) :代表,舊的檔案第21行之後增加新的資料,資料來至新的資料的第22行

24,26c31,33: 代表,從24至26行的資料會被新的檔案中的31至33行取代掉



參考資料:Read more:http://lowfatlinux.com/linux-compare-files-diff.html#ixzz1gIb6sZyY

 

 

沒有留言:

How to restore a deleted onenote page

復原不小心誤刪的onenote