Hot answers tagged


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


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


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


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


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.


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


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


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


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


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


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


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


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.


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


Try diff in the following combination of zsh/bash process substitution and colordiff in CLI: diff -y <(xxd foo1.bin) <(xxd foo2.bin) | colordiff Where: -y shows you differences side-by-side (optional) xxd is CLI tool to create a hexdump output of the binary file colordiff will colorize diff output (install via: sudo apt-get install colordiff) add -...


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 under %USERPROFILE%\AppData\Roaming\GHISLER\ by default, and add something like this: [Configuration] CompareTool=C:\Program Files\Shareware\FileCmp\BeyondCmp\BCompare....


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


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.


set diffopt+=iwhite from vim wikia


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.


diff --exclude=.svn ...


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


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


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.


Method that works for byte addition / deletion diff <(od -An -tx1 -w1 -v file1) \ <(od -An -tx1 -w1 -v file2) Output for a single NUL byte removal at the 100th byte of a large file: 100d99 < 00 If you also want to see the ASCII version of the character: bdiff() ( f() ( od -An -tx1c -w1 -v "$1" | paste -d '' - - ) diff <(f "$...


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


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} ${...


Rsync has a dry-run option: -n, --dry-run show what would have been transferred I am not sure if this is what you want. If you want to diff the files across two trees, you could maybe recursively search the two directions with find and pipe to output to ls and pipe both to a file. You could then use diff to compare the files.


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


command line: diff --exclude=direxclude -r dir1 dir2 openSUSE 12.1: ok. sttr@linux-sgfb:/tmp> md dir1 sttr@linux-sgfb:/tmp> md dir2 sttr@linux-sgfb:/tmp> cd dir2 sttr@linux-sgfb:/tmp/dir2> md 10 sttr@linux-sgfb:/tmp/dir2> md 11 sttr@linux-sgfb:/tmp/dir2> md 12 sttr@linux-sgfb:/tmp/dir2> md 14 sttr@linux-sgfb:/tmp/dir2> cd .. sttr@...

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