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
awk - comparing files dbrundrett Shell Programming and Scripting 4 08-22-2008 07:23 AM
Comparing two files ragavhere Shell Programming and Scripting 31 06-12-2008 01:12 AM
Comparing two files superstar003 Forum Support Area for Unregistered Users & Account Problems 1 05-08-2008 12:34 AM
Comparing two files... paqman Shell Programming and Scripting 12 08-08-2007 12:45 AM
comparing shadow files with real files terrym UNIX for Advanced & Expert Users 4 02-08-2007 10:38 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-29-2007
Registered User
 

Join Date: Aug 2007
Posts: 15
Stumble this Post!
Comparing two files..

Hai,

I am new to this forum..

I am having two files for compare..

1st file contains the values... like this

sourceFile:
Filename1 1234567
Filename2 2345678
Filename3 3456789

2nd file contains the values ..

destFile:
Filename2 5434567
Filename3 3456789


I have to compare sourceFile with destFile. And i have to sort sort the rows..which are same..

Output must be..

SucessTrans
Filename3 3456789

FailedTrans
Filename2
Filename1

can anyone please help me out ...
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 08-29-2007
robotronic's Avatar
Can I play with madness?
 

Join Date: Apr 2002
Location: Italy
Posts: 370
Stumble this Post!
Code:
SucessTrans=`comm -12 sourceFile destFile`
FailedTrans=`comm -23 sourceFile destFile | cut -f1 -d' '`

echo "SucessTrans\n${SucessTrans}"
echo "FailedTrans\n${FailedTrans}"
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 04:53 AM.


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

Content Relevant URLs by vBSEO 3.2.0