Tag Info

Hot answers tagged

58

Add --exclude=".svn" as an option like so: $ diff -r --exclude=".svn" src1/ src2/


56

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 ...


36

As ~quack (hehe) pointed out: % xxd b1 > b1.hex % xxd b2 > b2.hex And then % diff b1.hex b2.hex or % vimdiff b1.hex b2.hex


29

cmp is designed to find differences in binary files. You might also try checksumming (sum) and compare the hashes.


27

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


23

What about diff -rq DIR1 DIR2 or diff -rqb DIR1 DIR2 -r is recursive -q is for brief, and will just tell you if the files are different (i.e., it won't show the line-by-line differences) -b ignores whitespace


21

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 ...


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. ...


18

There's a tool called DHEX which may do the job, and there's another tool called VBinDiff. For a strictly command-line approach, try JDIFF.


17

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 ...


16

You were close. In bash you want process substitution, not command substitution: diff <(ls -1a ./dir1) <(ls -1a ./dir2)


13

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 ...


12

set diffopt+=iwhite from vim wikia


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 ...


11

If you're after a graphical diff command, you should give Meld a go. It's a visual diff and merge tool. I think it is present by default on Ubuntu systems


10

What about just using fc or comp? Both are included in Windows and should have no problems handling large files. In fact, 1 GiB is actually a pretty small file.


10

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.


10

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 ...


10

diff --exclude=.svn ...


10

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 ...


9

If all you need is a byte-by-byte comparison, use cmp: if cmp -s "$a" "$b"; then echo Same else echo Differ fi This avoids wasting time for diff's difference finding algorithm.


9

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.


8

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


8

Found a solution - the cmp tool which comes with most Linux flavours.


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 ...


8

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.


7

When diffing files I almost always use vim: vim -d file_1 file_2 It not only uses colours, it lines up the files so it's easier to see lines added/removed.


7

Listing directories should work; e.g., here's what I've used in a script (assuming gnu diff), diff -r \ --exclude="*~" \ --exclude=".svn" \ --exclude=".git" \ --exclude="*.zip*" \ --exclude="*.gz" \ --exclude="*.tar" \ ...etc ...which ignores contents of .svn and .git dirs, but also individual files named *.zip/*.gz/etc. Edit: In ...


7

On the Review tab, there's an option to compare documents and merge them into one:


7

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 ...



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