Script to find difference between 2 files by column | Unix Linux Forums | Homework & Coursework Questions

  Go Back    


Homework & Coursework Questions Students must use and complete the template provided. If you don't, your post may be deleted! Special homework rules apply here.

Script to find difference between 2 files by column

Homework & Coursework Questions


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-09-2013
shakthi666 shakthi666 is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 9 January 2013, 7:06 AM EST
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Script to find difference between 2 files by column

Hi , i am newbie to shell scripting and am trying to do the below job,

A shell script to be run with a command like

sh Compare.ksh file1.txt file2.txt 1 2 > file3.txt

1 2-are the key columns
Consider the delimiter would be Tab or comma

File 1:

SK TEST NAME MATHS PHYSICS
21 1 AAA 45 65
21 2 AAA 48 66
22 1 BBB 46 64
22 2 BBB 47 65
23 1 CCC 58 85
23 2 CCC 59 88

File 2:

SK TEST NAME MATHS PHYSICS
21 1 AAA 45 65
21 2 AAA 48 66
22 1 BBB 46 6
22 2 BBB 47 65
23 1 CCC 58 85
23 2 CC 59 88
And return result like,

File 3:

FILE SK TEST NAME PHYSICS
file1.txt 22 1 BBB 64
file2.txt 22 1 BBB 6
file1.txt 23 2 CCC
file2.txt 23 2 CC

Any expert help for this student?
Sponsored Links
    #2  
Old 01-09-2013
Scott's Avatar
Scott Scott is offline Forum Staff  
Administrator
 
Join Date: Jun 2009
Last Activity: 24 October 2014, 2:03 AM EDT
Location: Zürich
Posts: 8,484
Thanks: 332
Thanked 1,047 Times in 914 Posts
Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Script to find difference between 2 files by column shakthi666 Shell Programming and Scripting 1 01-09-2013 02:03 AM
script to find whether the difference between two files in only additions but not modifications under_cons Shell Programming and Scripting 1 10-17-2012 02:43 PM
to find difference between two files ganesh_248 Emergency UNIX and Linux Support 6 10-01-2009 12:19 AM
find difference in file column... malcomex999 Shell Programming and Scripting 1 04-15-2009 05:31 AM
script to compare first column of two files and find difference adityam Shell Programming and Scripting 3 10-22-2008 09:02 AM



All times are GMT -4. The time now is 03:47 AM.