Compare and merge two files using WinMerge比較和合併兩個文件使用WinMerge

Posted on November 17, 2008 at 5:54 am發布於08年11月17日在上午05時54分

If you have been on a situation wherein you need to compare two large text files or folders then this tutorial is for you.  In this example, given two almost identical text files,  I will show you how to determine the lines that have a mismatch.如果你一直在其中的情況下你需要比較兩個大型文字的文件或文件夾然後本教程是給你的。在這個例子中,兩個幾乎相同的文本文件,我會向你展示如何確定的路線有錯。

In a manual brute force scenario, this is painstakingly difficult to do especially for large text files.  The free tool is called WinMerge and you can get it from在一本手冊蠻力的情況下,這是艱苦困難的事特別是大型文本文件。免費的工具,被稱為WinMerge和你可以從 http://winmerge.org/ .  It is called WinMerge because it runs in Windows and it lets you merge the content of your files (ie you want to use the newer version of the text file). 。這就是所謂WinMerge ,因為它運行在Windows ,它可以讓您合併的內容您的文件(即要使用較新版本的文字檔案) 。

You can begin comparing two files by going to the Open menu:您就可以開始比較兩個文件要打開菜單:

形象

You will  be asked to enter the file names.  The file you entered on the left will appear on the left side of the screen while the right will appear on the opposite side.  The idea is to compare the two files side by side:您將被要求輸入檔案名稱。檔案您輸入左邊將出現在屏幕左側的權利,同時將出現在對面。想法是比較兩個文件並排:

形象

Press ok after entering the filenames.  In this case I entered two files called 1.epj and 2.epj which are plain text files.按確定後進入該文件名。在這種情況下,我進兩個文件要求1.epj和2.epj這是純文本文件。

Once you click OK, it will process the two files quickly and display the side-by-side comparison like below:當您單擊確定,它將進程的兩個文件迅速並顯示並排比較喜歡如下:

形象

The leftmost side, called Location Pane, contains a scaled “map” of the text file where you can see 3 yellow lines where the relative position of the mismatches are.  This is very usable so you can navigate to the mismatches quickly.  You can click any part of the Location Pane to jump to that part of the file.最左邊的一方,所謂的位置窗格中,包含一個縮放“地圖”的文本文件在那裡你可以看到三黃線的相對位置不匹配的。這是非常實用,您可以瀏覽到錯位迅速。您可以點擊任何部分的位置窗格跳到那部分文件。

The main window will show the two files side-by-side and from this interface it is very easy to see where the mismatches are.主窗口將顯示兩個文件並存,並從這個界面是很容易看到的不匹配的。

The View menu offers some functionality that you might find useful:在視圖菜單上提供了一些功能,您可以找到有用的:

形象

For people working with UNIX scripts, the white spaces are important.  You can use the View Whitespace option to be able to view the whitespace.  The white spaces will appear as a tick-like character:為人民工作的UNIX腳本,白色的空間是很重要的。您可以使用查看空白選項,可以查看的空白。白色的空間將顯示為一剔樣性質:

形象

If your boss or programs (ie UNIX scripts) are sensitive to white spaces, this is an excellent tool to determine where those “invisible” spaces are.如果你的老闆或程序(即UNIX的腳本)是敏感的空格,這是一個極好的工具,以確定那些“看不見”的空間。

Upon determining the differences, there are times that we need to merge the files.  In this case I can replace the line from the left with the line from the right using the replace buttons:經確定的差異,有時候,我們需要合併的文件。在這種情況下我可以取代線從左邊的線從右邊使用取代按鈕:

形象

You can use the button to replace a line on the left side by the line on the right side (or vice versa).您可以使用按鈕來代替線左側的線右邊(或反之亦然) 。

形象

After clicking the button, the mismatch will disappear (after it “merged” the line):在按一下按鈕,錯將消失(後, “合併的”線) :

形象

Overall, WinMerge is one powerful dif tool.總體而言, WinMerge是一個功能強大的差異的工具。 It is easy to use and should be good enough for most file and folder comparison.  It’s merging capability also helps most writers who need to use a new version of a certain portion of a document.它易於使用,並且要善於足以滿足大多數文件和文件夾比較。這是合併的能力也有助於作家誰最需要使用新版本的某一部分的文件。

Ben Carigtan writes about technology, computers, websites and how to get the best out of them.本Carigtan寫技術,計算機,網站,以及如何得到最好的了他們。

Enjoyed this post?得到這個職位? Subscribe to Online Tech Tips via訂閱在線應用技巧通過 RSS Feed RSS供稿 or via或通過 Email電子郵件 and receive free daily productivity tips.並獲得免費日報的生產力秘訣。

» Filed Under »文章屬於 Computer Tips計算機提示

添加到美味 Save this page 保存該網頁 它Mixx Stir it up on Mixx 它攪動了Mixx
Reddit Add to Reddit 添加到Reddit StumbleUpon公司 Stumble this page 失敗此頁

Related Posts 有關職位

One Response to “Compare and merge two files using WinMerge” 一對“比較並合併兩個文件使用WinMerge ”

  1. restful web 寧靜的網頁 said on : 說:

    WinMerge is a must-have tool for me, especially when working with shared version control systems like subversion or CVS. WinMerge是一個必須擁有的工具,對我來說,特別是當工作與共享版本控制系統,如顛覆或CVS 。 Saves me a lot of time.節省了我很多的時間。

    One of its best features is the ability to compare two directories.它的一個最好的特點是能夠比較兩個目錄中。 That’s great when you have a bug-fix branch that needs to be merged with the development branch.這是偉大的當你有一個缺陷修復分支,需要加以合併,發展分支。


    Please post your comments/suggestions! 請張貼您的意見/建議!