The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Pattern Matching problem in UNIX maxmave Shell Programming and Scripting 2 06-02-2008 10:19 PM
pattern matching problem namishtiwari Shell Programming and Scripting 2 05-23-2008 04:33 AM
problem with CASE pattern matching gummysweets Shell Programming and Scripting 2 03-18-2008 08:30 AM
pattern matching problem rein Shell Programming and Scripting 8 10-26-2007 08:44 PM
Problem with pattren Matching pbsrinivas Shell Programming and Scripting 7 11-27-2006 01:17 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 07-23-2008
Registered User
 

Join Date: Jun 2008
Posts: 12
Smile matching file problem

hi
I need help for matching two files

a.txt
123,20080921,2419,ec1,20081021
456,20080923,2420,ec1,20081021
789,20080920,2419,ec1,20081021
124,20080921,2421,ec1,20081023
125,20080921,2419,ec1,20081021
126,20080921,2419,ec1,20081021
128,20080921,2419,ec1,20081021

b.txt

123,20080922,2419,ec1,20081021
456,20080923,2420,ec1,20081021
789,20080920,2418,ec1,20081021
124,20080921,2421,ec2,20081023
125,20080921,2419,ec1,20081021
126,20080921,2419,ec1,20081021
129,20080921,2419,ec1,20081021


I want to compare both files
i want the line of first file which is different from 2nd file in any of the field
like here first line differ in 2nd coloum value
simirly 3rd line differ in 3rd coloum value
last line is not in list so it should also come in output


output will be like
c.txt

123,20080921,2419,ec1,20081021
789,20080920,2419,ec1,20081021
124,20080921,2421,ec1,20081023
125,20080921,2419,ec1,20081021
126,20080921,2419,ec1,20081021
128,20080921,2419,ec1,20081021

these all line have atleast different value.
pls help ....
Reply With Quote
Forum Sponsor
  #2  
Old 07-23-2008
Ygor's Avatar
Moderator
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,249
Try...
Code:
paste a.txt b.txt | awk -F '\t' '$1!=$2 {print $1}'
Reply With Quote
  #3  
Old 07-23-2008
Registered User
 

Join Date: Jul 2008
Location: BlackMesh Managed Hosting
Posts: 66
This sounds suspiciously like all you really want is "diff", perhaps with some strict line-position requirements?
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 01:46 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0