diff - Command-line tool to display the differences between two files, or each corresponding file in two directories.

learn more… | top users | synonyms

2
votes
1answer
2k views

Diff the output of two `awk` commands

I'm trying to compute the difference between the output of two awk commands but my simple attempts at it seem to be failing. Here is what I'm trying: diff $(awk '{print $3}' f1.txt | sort -u) $(awk ...
6
votes
2answers
1k views

Comparing directories in Emacs

I am experimenting with ediff-directories, but I am not sure I am using it correctly. I read in the documentation that, once I supply two directories to ediff-directories, if I press == Emacs ...
1
vote
1answer
457 views

Reading two files into an IFS while loop — Is there a way to get a zero diff result in this case?

I have a text file full of several hundred lines of sequences like this: b 29. b 52. c 84. c 83. c 94. c 93. c 61. b 38. c 81. c 92. c 28. c 37. ...
2
votes
1answer
2k views

Patching a file (in this case dwm) and failed hunks

I'm trying to add the transparency patch to dwm. I downloaded the .diff file and in my dwm directory ran this: max@linux-vwzy:~/misc/dwm/dwm-5.9> patch < dwm-transparency.diff patching file ...
3
votes
3answers
242 views

Track daily directory changes (and email them)

I have a Debian powered NAS server (ReadyNAS) with a deep file hierarchy. I'd like to get notified daily about what has changed in some of its directories and their subdirectories. So if someone ...
7
votes
4answers
744 views

How can I get the most bang for my buck with the “diff” command?

I have tried using the linux diff command in the past without much luck or patience. I usually end up using a GUI utility like DiffMerge or Kdiff. Recently I started trying to use diff again to ...
6
votes
2answers
3k views

How do I save changed files?

I have two folders: ORIGINAL/ ORIGINAL_AND_MY_CHANGES/ My friend has a copy of ORIGINAL/. I would like to generate MY_CHANGES.tgz -- it should contain only new/changed files from ...
3
votes
4answers
547 views

On Unix how do I get the output from the diff command to look like a man page? Where I can press 'b' or 'f' to read further or back?

You know how when you use the man command to read the manual (e.g. man ls) and you get output that is paginated that you can read from top to bottom by pressing 'f' to go read further down and 'b' to ...
1
vote
1answer
68 views

Program to upgrade configuration files

When upgrading Ubuntu (and probably other *nixes), the upgrade process will show a diff of changed configuration files and ask whether I'd like to replace them, keep the old version, or manually merge ...
6
votes
2answers
3k views

diff where lines are mostly the same but out of order?

I want to diff two sets of mod_rewrite rules. The set of lines are about 90% identical, but the order is so different that diff basically says they are completely different. How can I see which lines ...
4
votes
4answers
1k views

Error with if [ -n $diffCurr ]: Too many arguments

I have been using the below code ok for sometime, but now, I get an error java Editor < "input/editor$i.in" > "tmp/editor$i.out" diffCurr="$(diff "tmp/editor$i.out" "output/editor$i.out")" if [ ...
8
votes
9answers
5k views

linux diff tools: create list of modified files

How do I create a list of modified files programmatically using linux command line tools? I'm not interested in the difference in any particular file (delta, patch). I just want to have a list of new ...
2
votes
2answers
206 views

How to determine if file is just a permutation of another one?

Consider for example a source code file, where the functions are drastically shuffled around. Is there is a command to check if the reordering of lines is the only change? (that means no lines are ...
1
vote
1answer
812 views

Diff similar lines

I'd like to print a list of lines where the first word in two files is identical, and the rest of the words are not. Some complicated mess with comm, grep and cut would be possible, but hopefully ...
2
votes
2answers
525 views

Comparing files and their properties

I get information of a certain set of files in my mail every day, which looks like this: 58623208 Sep 14 20:08 blbn_blfbe_drv 57904920 Sep 14 19:54 blbn_cycmn 55814208 Sep 14 06:02 clsa_Upd 38912000 ...
5
votes
4answers
919 views

Compare an old file and new file, but ignore lines which only exist in new file?

I have two files: oldlist - This contains a list of files and a md5 hash for each file. This was generated one year ago. newlist - This also contains a list of files and a md5 hash for each file. ...
5
votes
1answer
323 views

merge that works at word granularity instead of line

The old diff, patch, and merge programs, and their modern descendents in the form of version control systems work great for managing source code that can be edited concurrently by multiple people. ...
5
votes
1answer
727 views

Comparing text files on Emacs

I have a couple of questions about comparing text files on Emacs I have been playing with M-x compare-windows and I read in the documentation that, if I pass it a numeric argument, Emacs ignores ...
1
vote
1answer
382 views

RPMs and patching

I have 3 files (from here)that I have been given to install in an attempt to upgrade the compiler: binutils-2.13.2.1-1.mipsel.rpm binutils-2.13.2.1-1.src.rpm binutils-2.13.2.1-r5900-7.diff.gz ...
19
votes
4answers
13k views

How to diff files ignoring comments (lines starting with #)?

I've two configuration files, the original from the package manager and a customized one modified by myself. I've added some comments to describe behavior. How can I run diff on the configuration ...
4
votes
2answers
902 views

diff a gzipped tarball against a directory?

Is there a way I can diff a gzipped tarball against an existing directory? I would like to be able to do it without extracting the data from the tarball.
1
vote
1answer
662 views

Pipe diff file into patch?

Is there a way to pipe the diff output into patch? The -i parameter is for specifying a diff file, but I just want to do it more dynamically, since I will be updating regularly against a directory ...
1
vote
2answers
939 views

Comparing two directories in different servers

We copy our production code and data files to a testing server on a weekly basis. It can take hours, and sometimes it hasn't finished. What is the best method to confirm that the directories have ...
2
votes
3answers
1k views

Total Commander “compare content” like alternative?

I'm searching a GUI [or CLI] tool that can produce output like the Total Commander compare content function does! For example: Are there any that do that? It's a very handy tool and I miss it
13
votes
7answers
7k views

diff within a line

I have some sql dumps that I am looking at the differences between. diff can obviously show me the difference between two lines, but I'm driving myself nuts trying to find which values in the long ...
6
votes
1answer
2k views

Make diff Use Full Terminal Width in Side-by-Side Mode

Most applications are smart about using the full width of the terminal available to them. My shell does, screen, vim, etc. However, diff in side-by-side mode (-y), does not. This angers me. It uses ...
5
votes
6answers
3k views

Compare files that are in directory 1 but not directory 2?

I'm having trouble with a bash script I want to make I know ls will list files that are in a directory but I want it to list directories that are in directory1 but NOT in directory2, and then list ...
1
vote
1answer
790 views

What is the difference between Context output format and Unicode output format while taking diff?

What is the difference between Context output format and Unicode output format when taking a diff? diff -NBur dir1/ dir2/ diff -NBcr dir1/ dir2/
4
votes
1answer
411 views

How to use diff tool to take a diff between directories with libraries and source?

I would like to know if i can use the diff tool to take the difference between two folders which contain sources as well as libraries and executable. Right now i gave diff -Naur dir1/ dir2/ ...
17
votes
7answers
21k views

Which GUI diff viewer would you recommend, with Copy-to-Left/Right functionality?

I've hardly ever used anything other than Meld. Can you recommend anything else? It would be extra nice if you give a reason for your recommendation (as a Comment). [note] I want an alternative ...
4
votes
1answer
3k views

Recursively compare directory contents by name, ignoring file extensions

I have a directory containing about 7,000 music files. I used lame to recursively re-encode all files in it to a separate directory, outputting all files with the same relative path and file name. ...
6
votes
2answers
6k views

Diffing two big text files

I have two big files (6GB each). They are unsorted, with linefeeds (\n) as separators. How can I diff them? It should take under 24h.
3
votes
1answer
3k views

What does 'patch unexpectedly ends in middle of line' mean?

This is the output of my patch command: Hunk #11 merged at 4184,4190. Hunk #12 merged at 4444. Hunk #13 merged at 4944. Hunk #14 NOT MERGED at 5106-5116. Hunk #15 merged at 5290. Hunk #16 merged at ...
15
votes
3answers
15k views

Comparing two files in Vim

Is it possible to view two files side-by-side in Vim? If so, how can I set up my editor to do this, and is there a way to diff between the two files within Vim? I am aware of the :next and :prev ...
9
votes
5answers
9k views

Output the common lines (similarities) of two text files (the opposite of diff)?

Diff is a great tool to display the changes between two files. But how to display the similarities of two text files (while ignoring the differences)? I.e. sample input: a: Foo Bar X Hello World 42 ...
23
votes
4answers
8k views

Can't pipe into diff?

I wanted to be clever and compare a remote file to a local file without downloading it. I can get the contents of the remote file by ssh user@remote-host "cat path/file.name" However, piping that ...
10
votes
4answers
439 views

rolling diffs for storage of highly similar files?

At work we do a nightly dump of our mysql databases. From day to day, I would guestimate that close to 90-95% of the data is duplicate, increasing as time goes on. ( Heck at this point some are ...