Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

File comparison

From Wikipedia, the free encyclopedia
Diff and merge files on computers
This article is about data object, text, and file comparisons in computing. For other uses, seeComparison.
TheKDEdiff toolKompare

Incomputing,file comparison is the calculation and display of the differences and similarities between data objects, typicallytext files such assource code.

The methods, implementations, and results are typically called adiff,[1] after theUnixdiff utility. The output may be presented in agraphical user interface or used as part of larger tasks innetworks,file systems, orrevision control.

Some widely used file comparison programs arediff,cmp,FileMerge,WinMerge,Beyond Compare, andFile Compare.

Manytext editors andword processors perform file comparison to highlight the changes to a file or document.

Method types

[edit]

Most file comparison tools find thelongest common subsequence between two files. Any data not in the longest common subsequence is presented as a change or an insertion or a deletion.

In 1978, Paul Heckel published an algorithm that identifies most moved blocks of text.[2] This is used in theIBM History Flow tool.[3] Other file comparison programs find block moves.[clarification needed]

Some specialized file comparison tools find thelongest increasing subsequence between two files.[4] Thersync protocol uses arolling hash function to compare two files on two distant computers with low communication overhead.

File comparison in word processors is typically at the word level, while comparison in most programming tools is at the line level. Byte or character-level comparison is useful in some specialized applications.

Display

[edit]

Display of file comparison varies, with the main approaches being either showing two files side-by-side, or showing a single file, with markup showing the changes from one file to the other. In either case, particularly side-by-side viewing,code folding ortext folding may be used to hide unchanged portions of the file, only showing the changed portions.[clarification needed]

Reasoning

[edit]

Comparison tools are used for various reasons. When one wishes to compare binary files, byte-level is probably best. But if one wishes to comparetext files orcomputer programs, a side-by-side visual comparison is usually best.[5] This gives the user the chance to decide which file is the preferred one to retain, if the files should be merged to create one containing all the differences,[6] or perhaps to keep them both as-is for later reference, through some form of "versioning" control.

File comparison is an important, and most likely integral, part offile synchronization andbackup. In backup methodologies, the issue ofdata corruption is an important one. Corruption occurs without warning and without one's knowledge; at least usually until too late to recover the missing parts. Usually, the only way to know for sure if a file has become corrupted is when it is next used or opened. Barring that, one must use a comparison tool to at least recognize that a difference has occurred. Therefore, all file sync or backup programs must include file comparison if these programs are to be actually useful and trusted.[7]

Historical uses

[edit]

Prior to file comparison, machines existed to compare magnetic tapes or punch cards. TheIBM 519 Card Reproducer could determine whether a deck ofpunched cards were equivalent. In 1957,John Van Gardner developed a system to compare thecheck sums of loaded sections ofFortran programs todebug compilation problems on theIBM 704.[8]

See also

[edit]

References

[edit]
  1. ^"diff", The Jargon File.
  2. ^Heckel, Paul (1978),"A Technique for Isolating Differences Between Files"(PDF),Communications of the ACM,21 (4):264–268,doi:10.1145/359460.359467,S2CID 207683976, retrieved2011-12-04
  3. ^Viégas, Fernanda B.; Wattenberg, Martin; Kushal, Kushal Dave (2004),Studying Cooperation and Conflict between Authors with history flow Visualizations(PDF), vol. 6, Vienna: CHI, pp. 575–582, retrieved2011-12-01
  4. ^Liwei Ren; Jinsheng Gu; Luosheng Peng (18 April 2006)."Algorithms for block-level code alignment of software binary files".Google Patents. USPTO. Retrieved10 May 2019.
  5. ^MacKenzie, David; Eggert, Paul; Stallman, Richard (2003).Comparing and Merging Files with Gnu Diff and Patch. Network Theory.ISBN 978-0-9541617-5-0.
  6. ^"File comparison software: vc-dwim and vc-chlog".www.gnu.org. Retrieved2023-04-16.
  7. ^"SystemRescue - System Rescue Homepage".www.system-rescue.org. Retrieved2023-04-16.
  8. ^John Van Gardner."Fortran And The Genesis Of Project Intercept"(PDF). Retrieved2011-12-06.

External links

[edit]
Wikimedia Commons has media related toFile comparison.
Types
Properties
Organisation
Operations
Linking
Management
Years, where available, indicate the date of first stable release. Systems with namesin italics are no longer maintained or have planned end-of-life dates.
Local only
Free/open-source
Proprietary
Client–server
Free/open-source
Proprietary
Distributed
Free/open-source
Proprietary
Concepts
Retrieved from "https://en.wikipedia.org/w/index.php?title=File_comparison&oldid=1336514258"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp