Tag Info

Hot answers tagged

46

This will print the offset and bytes in hex: cmp -l file1.bin file2.bin | gawk '{printf "%08X %02X %02X\n", $1, strtonum(0$2), strtonum(0$3)}' Or do $1-1 to have the first printed offset start at 0. cmp -l file1.bin file2.bin | gawk '{printf "%08X %02X %02X\n", $1-1, strtonum(0$2), strtonum(0$3)}' Unfortunately, strtonum() is specific to GAWK, so you ...


21

From the TortoiseHg FAQ: Add these lines to your personal Mercurial.ini file [extdiff] cmd.winmerge = C:\Program Files\WinMerge\WinMerge.exe opts.winmerge = /e /x /ub /wl Now run the Global Settings tool. On the TortoiseHg tab, you should see winmerge available in the drop-down list for Visual Diff Command. Select winmerge, apply, then close. ...


20

Meld (alternative link) Meld is a visual diff and merge tool. You can compare two or three files and edit them in place (diffs update dynamically). You can compare two or three folders and launch file comparisons. You can browse and view a working copy from popular version control systems such such as CVS, Subversion, Bazaar-ng and Mercurial. Look at the ...


17

One approach would be to first turn both XML files into Canonical XML, and compare the results using diff. For example, xmllint can be used to canonicalize XML. $ xmllint --c14n one.xml > 1.xml $ xmllint --c14n two.xml > 2.xml $ diff 1.xml 2.xml


12

WinMerge - (free and on Windows), accoriding to the Wikipedia article is currently dormant (not that means much if it works and is stable/complete) Web based: http://diffchecker.com/diff - was able to uploaded 2 binary files for a But I still do strongly recommend Beyond Compare as it is my favourite file comparison tool and I'm not alone see ...


12

Not sure diff alone can do it but you can always use the power of other GNU utilities to help you. diff -u diffa.txt diffb.txt | grep '^-[^-]' | sed 's/^-//' It does the diff, then selects only the lines that begins with '-' - those are changed and have values from diffa.txt file, then sed just remove those '-' signs. Edit: After few experiments with ...


11

I like diffuse: Diffuse is a graphical tool for merging and comparing text files. Diffuse is able to compare an arbitrary number of files side-by-side and gives users the ability to manually adjust line-matching and directly edit files. Diffuse can also retrieve revisions of files from Bazaar, CVS, Darcs, Git, Mercurial, Monotone, Subversion, and SVK ...


9

One of the fields in the gzip header is different between the two files. One such field is the last modified time of the compressed file (in seconds since 1970), or if the compressed data was not read from a file, then the time when the file was compressed. Even a one second difference is enough to make the gzip files not match.


9

One of the most common ways of determining if two files are identical (assuming their sizes match) is using a program to create a "hash" (essentially a fingerprint) of a file. The most common ones are md5sum and sha1sum. For example: $ md5sum file1 file2 e0e7485b678a538c2815132de7f9e878 file1 4a14aace18d472709ccae3910af55955 file2 If you have many ...


9

Perl has a a lackluster colordiff wrapper for diff, but I prefer grc (generic colorizer). With grc (generic colorizer), you can write your own wrappers for different types of commands or inputs (if you like that sort of thing). Below, grc is running against /var/log/syslog (in the config, this file is set to a certain color scheme), where it highlights ...


8

Use the comp command under cmd.exe [C:\]comp /? Compares the contents of two files or sets of files. COMP [data1] [data2] [/D] [/A] [/L] [/N=number] [/C] [/OFF[LINE]] data1 Specifies location and name(s) of first file(s) to ...


7

Looks like SourceGear DiffMerge will give you this, with its ruleset support for XML (and lots of other languages). I'm not sure if it will fix all your problems, because the example is of course a simplification of the actual program. I tried slightly more complex changes, and those seem to work fine too. See the sample below for the diff you described


7

In Eclipse, go to Window > Preferences. Then search for "patch" and click on General > Compare/Patch. Check Ignore white space. Now only the details that matter in the diff will show up.


6

You basically need to compare two files, conditionally ignoring the trailing byte. There isn't a 'diff' option to do this -- but there are a number of ways it could be done (e.g, hex diff comes to mind as well.) To use 'diff', you basically have to modify the files that are missing the newline at the end of a file, and then compare. You could create a ...


6

I see two solutions: you would have to test the current syntax highlighting to jump to the red part in the line. you would have to extract the current line in both buffers and find the first character that differs to position correctly the cursor Both solutions need to be executed after the ]c, and require vim scripting. EDIT: Here is a first draft that ...


6

You should probably take a look at the rsync-related tools: rdiff and rdiff-backup. The rdiff command lets you produce a patch file and apply it to some other file. The rdiff-backup command uses this approach to deal with entire directories, but I'm guessing you're working with single-file disk images, so rdiff will be the one to use.


6

Edit: Apparently there is a built in alias so this works too: diff $(Get-Content C:\file1.txt) $(Get-Content C:\file2.txt) You can do this: Compare-Object $(Get-Content c:\file1.txt) $(Get-Content c:\file2.txt) This is some sample output: InputObject SideIndicator ----------- ------------- This ...


6

Perhaps the free merge tool Apple provides with Xcode will do enough of what Beyond Compare does for you. It's called file merge. It can do two way and three way file comparisons, the merging of changes, and directory comparisons and synchronization. It does not have specialized viewers for stuff like ID3 tags and images.


5

This is how it works for me -- pure mercurial command line other than tortoisehg First, edit file (under a 64bit windows) C:\Program Files (x86)\Mercurial\Mercurial.ini [extensions] ; must uncomment this line extdiff = [extdiff] ; i'm using winmerge unicode version cmd.winmerge = C:\Program Files (x86)\WinMerge\WinMergeU.exe ; it explains winmerge ...


5

Did you try the built-in compare functionality? Edit / Compare Document... If you just want a textual diff, your best bet is probably to convert both documents to plain text, then run a regular diff on them. You will have to figure out how to normalize linebreaks though, otherwise the diff will not be very useful.


5

I found this link diff -H might help, or you can try installing the textproc/2bsd-diff port which apparently doesn't try to load the files into RAM, so it can work on large files more easily. I'm not sure if you tried those two options or if they might work for you. Good luck.


5

If all you need to know is whether the files differ or not, use cmp. Or, more precisely: if cmp "$FILE1" "$FILE2"; then echo same else echo different fi (Or whatever you need to do when they're equal/not-equal). cmp should be present on any posix-like system, works on both binary and text files, and returns immediately when it finds a difference, ...


5

Here you go: diff <(head -n 1 file1) <(head -n 1 file2) (this would return nothing what-so-ever). diff <(head -n 2 file1) <(head -n 2 file2) Returns: 2c2 < 1 --- > 3 You could incorporate that into a script to do the things you mention. #!/bin/bash fileOne=${1} fileTwo=${2} numLines=${3:-"1"} diff <(head -n ${numLines} ...


4

DiffPDF DiffPDF is used to compare two PDF files—textually or visually. DiffPDF can compare two PDF files. It offers three comparison modes: Words, Characters, and Appearance. http://www.qtrac.eu/diffpdf.html


4

What you have in front of you is a so-called "patch file". A patch file contains instructions to change a given file from one version to another. In this example, you already have the file and it is assumed to be version A. The patch file changes it to a version B. You need to apply this patch with the patch command: patch -p1 < path/to/patchfile.patch ...


4

The classic toolset is context diff and patch. See a ten minute guide to diff and patch


4

You could use the vim plugins published here. Then you just need to set the difftool: [multidiff] tool = vd -f As an alternative application I would suggest meld, which will show you modified files - you can then select just the files who's diffs you want to see. See the screenshot here for an example. Further to Marcos useful comment, as a third ...


4

In Windows PowerShell (direct port of grawity's diff/grep combo): Compare-Object (Get-Content file1) (Get-Content file2) | Where-Object { $_.SideIndicator -eq '=>' } | Select-Object -ExpandProperty InputObject This can be shortened to: diff (gc file1) (gc file2) | ?{$_.SideIndicator -eq '=>'} | %{$_.InputObject} or wrapped in a function ...


4

There are many ways to do this (here I'm using BeyondCompare as an example, it's the best I've found in this category, but the solution also works well with WinMerge): A) Edit wincmd.ini, and add something like this: [Configuration] CompareTool=C:\Program Files\Shareware\FileCmp\BeyondCmp\BCompare.exe Now all comparisons are made using this app instead ...


4

Free Options for diff viewing/editing/merging: Diffuse AJC Diff KDiff DiffMerge Tortoise Merge Meld * WinDiff Diff Tool * Wikipedia's recommendations: Comparison_of_file_comparison_tools *Support Syntax Highlighting



Only top voted, non community-wiki answers of a minimum length are eligible