Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compare two files and have the same format for the output 1

Status
Not open for further replies.

zephan

Programmer
Jan 14, 2002
217
A2
Hi All,
I have got two huge comma separated files. The files have the same format (means the same order of fields). I want to compare between the two files and obtain a third file with the same format (comma separated and the same order of fields). Is it possible to do this by using a simple command or a combination of commands.

Best Regards,
Zeph
 
Sorry, but crystal bowl is in vacation today ..
 
Something very simple :
File1 is :
1,A,B,C
2,D,E,F
3,D,F,C

File2 is :
1,A,B,C
2,D,E,F
3,D,F,G
4,F,T,G

The ouptut must be
File3:
3,D,F,G
4,F,T,G

I know there is a command "diff" that lists the differences between two files, but it is not suitable as it outputs extra characters.



 
So, you want all lines in File2 not in File1 ?
fgrep -v -f File1 File2 > File3

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top