Register
It is currently Fri Dec 19, 2014 4:58 pm

need to compare 2 csv files and exclude columns from comp


All times are UTC - 6 hours


Post new topic Reply to topic  [ 1 post ] 
Author Message
 PostPosted: Fri Apr 25, 2014 12:34 am   

Joined: Fri Apr 25, 2014 12:29 am
Posts: 1
Need to compare 2 csv files. I plan to use awk to compare files.

I need this script to:
1. Script should print lines that differ(not print lines that match.)
2. Script should take array containing column numbers to exclude from compare
3. If lines differ, script should output 2 lines, one from each file and prefix with line nr and the filename it originates from.
4. If more lines found in one file it should print those lines and prefix with line number and the filename it originates from.

Example(without excluded columns):
File2.txt:
ID,version,cost
1000,1,30
2000,2,40
3000,3,50
4000,4,60

File1.txt:
ID,version,cost
1000,1,30
2000,2,45
3000,4,55
5000,5,70
6000,6,80

output:
3,File2.txt,2000,2,40
3,File1.txt,2000,2,45
4,File2.txt,3000,3,50
4,File1.txt,3000,4,55
5,File2.txt,4000,4,60
5,File1.txt,5000,5,70
6,File1.txt,6000,6,80


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP