08-08-2012
if your files are 'sorted' or if you don't care about the order, look into
comm.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
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)
Discussion started by: blt123
2 Replies
2. UNIX for Dummies Questions & Answers
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)
Discussion started by: paulp
3 Replies
3. Shell Programming and Scripting
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)
Discussion started by: bobk544
2 Replies
4. Shell Programming and Scripting
I'm asking for explanation about the output of the diff format when i compare the two files f1 and f2:
root@host1 # cat f1
205226
205237
205250
205255
205262
205274
205307
205403
205464
205477
205500
205520
205626
205759
205766
205776 (2 Replies)
Discussion started by: ahmad.zuhd
2 Replies
5. Shell Programming and Scripting
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
f1.txt
210 998877 phone 9981128209 add 111 nw st.... (2 Replies)
Discussion started by: blackjack101
2 Replies
6. Shell Programming and Scripting
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)
Discussion started by: Daniel Gate
5 Replies
7. Shell Programming and Scripting
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)
Discussion started by: stevensw
1 Replies
8. UNIX for Dummies Questions & Answers
35d34
<
What does that mean in diff? (3 Replies)
Discussion started by: glev2005
3 Replies
9. UNIX for Dummies Questions & Answers
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)
Discussion started by: Buckaroo Banzai
5 Replies
10. Shell Programming and Scripting
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)
Discussion started by: gaurav99
11 Replies
COMM(1) BSD General Commands Manual COMM(1)
NAME
comm -- select or reject lines common to two files
SYNOPSIS
comm [-123i] file1 file2
DESCRIPTION
The comm utility reads file1 and file2, which should be sorted lexically, and produces three text columns as output: lines only in file1;
lines only in file2; and lines in both files.
The filename ``-'' means the standard input.
The following options are available:
-1 Suppress printing of column 1, lines only in file1.
-2 Suppress printing of column 2, lines only in file2.
-3 Suppress printing of column 3, lines common to both.
-i Case insensitive comparison of lines.
Each column will have a number of tab characters prepended to it equal to the number of lower numbered columns that are being printed. For
example, if column number two is being suppressed, lines printed in column number one will not have any tabs preceding them, and lines
printed in column number three will have one.
The comm utility assumes that the files are lexically sorted; all characters participate in line comparisons.
ENVIRONMENT
The LANG, LC_ALL, LC_COLLATE, and LC_CTYPE environment variables affect the execution of comm as described in environ(7).
EXIT STATUS
The comm utility exits 0 on success, and >0 if an error occurs.
SEE ALSO
cmp(1), diff(1), sort(1), uniq(1)
STANDARDS
The comm utility conforms to IEEE Std 1003.2-1992 (``POSIX.2'').
The -i option is an extension to the POSIX standard.
HISTORY
A comm command appeared in Version 4 AT&T UNIX.
BSD
December 12, 2009 BSD