Unix file comparison [message #179863] |
Thu, 29 June 2006 02:13 |
Brayan
Messages: 315 Registered: June 2002
|
Senior Member |
|
|
Hi,
I need some help in unix scripting.
I've 2 files.
"File1" contents like:
1
2
3
4
5
"File2" contents like:
1
4
2
5
I need a output in "File3" as :
3
Here 3 is missing in "File2"
Thanking you in advance,
Ronald.
|
|
|
|
|
Re: Unix file comparison [message #180037 is a reply to message #179871] |
Thu, 29 June 2006 21:48 |
rleishman
Messages: 3728 Registered: October 2005 Location: Melbourne, Australia
|
Senior Member |
|
|
You may need to sort the files first:sort file1 > file1a
sort file2 > file2a
Then use commcomm -23 file1a file2a # lines that only appear in file1a
comm -13 file1a file2a # lines that only appear in file2a
Ross Leishman
|
|
|
|