I need to compare two directories with tab separated files. I'm using diff to do this. diff output doesn't identify which column values are different, it just tells which lines are different. Is there any way to format diff output. Thanks
I just did this quick at the command line, and cut and paste when the results returned correctly. You're better off creating an awk command file and using the -f option to run these awk commands. i.e.
I assumed that columns 1-3 always matched. If incorrect you can modify to your needs.
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 2,288
Thanks Given: 430
Thanked 480 Times in 395 Posts
Hi.
There are several schemes to draw attention to the areas in lines which differ. One such is colordiff. Colorized text is not easy to paste in here, but the program can also do an interesting job by marking up the lines with subtractions and additions. For example:
producing:
Although not shown here, the surrounded strings are also colored on the display. The command can also run diff internally, but I did not find that display as useful as the one involving word-diff -- wdiff.
The colordiff was in the Debian repository I use, but you can also find it at ColorDiff for several flavors of *nix.
I think that Jeffrey Friedl wrote a perl code that high-lighted differences by inverting the display scheme for the parts of the strings that differed. However, I could not find that code with a quick Google. It may be in one of his books on regular expressions, Mastering Regular Expressions, Third Edition - O'Reilly Media
I'm sure that there are other solutions, likely found by searching with keywords such as high-lighting, differences, etc.
I am running diff between two directories dir1 and dir2.
diff --exclude --recursive --brief -b dir1 dir2
The output of the above command is
Files dir1/java/abc/bcd/abc9991.java and dir2/java/abc/bcd/abc9991.java differ
Files dir1/java/abc/bcd/abc9933.java and... (11 Replies)
Hi,
I wasn't sure whether to post this in the dummies or expert section, here's what I'm trying to do, but I suspect I'm missing the boat and should perhaps be using some of diff's builtin output functionality.
diff -yb --suppress-common-lines file1.js file2.js >> ~/results.txt
When I... (5 Replies)
How to get diff to not print the chevrons and the dashes? In this case the differences are all single line differences.
Also the first few lines don't matter. How to get the output to always exclude the first few lines? Thanks! (1 Reply)
I have two files to compare, but diff output doesn't give me decent output I want.
The portion of the two files are shown below.
file 1)
Authorize <1>
Transaction Database Slave 3 <1>
CPM HTTP Proxy Server <1>
SSP (TDB Server) <1>
CPM Application Authorization <7>
CPM Script... (5 Replies)
Hi
when we diff of 2 files then output is showing lines which are different and then we have to manually find which word is different
diff file1 file2
is there any way to show or highlight ONLY the words which are different via diff or some other command ?
Thanks
rel (1 Reply)
Hi,
i need to display the mismatches from two files.The output what is get is the entire rows which mismatch from file 1 are displayed first and the corresponding rows from file 2 are displayed below it.
Sample output:
From Test Run 1 - The row count of file2.txt is 23
From Test Run 1 -... (9 Replies)
Hello is there a way to limit the number of lines output by the DIFF command?
I tried -C 200 ect and -c but it continues to print out the whole huge file.
Reason needed is i'm trying to do alot of DIFFs on a long list of files and would like to only get back an indicator which files are... (2 Replies)
I have two CSV files and I would like to create a third CSV file containing the differences between the two.
I understand the diff command can be used to list differences between two files. My problem is that when I pipe the output into a third CSV file, the line numbers and other formatting... (3 Replies)
Hello,
I want to compare two files. All records in file 2 that are not in file 1 should be output to file 3.
For example:
file 1
123
1234
123456
file 2
123
2345
23456
file 3 should have
2345
23456
I have looked at diff, bdiff, cmp, comm, diff3 without any luck! (2 Replies)