The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Shell Programming and Scripting nivas Shell Programming and Scripting 20 02-27-2008 06:36 AM
Shell Programming and Scripting nivas Shell Programming and Scripting 21 02-25-2008 06:27 AM
Shell Programming and Scripting nivas Shell Programming and Scripting 14 02-20-2008 02:07 AM
Shell Programming and Scripting nivas Shell Programming and Scripting 3 02-13-2008 08:10 AM
Shell scripting & programming languages aloysius1001 UNIX Desktop for Dummies Questions & Answers 1 02-19-2002 12:04 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-20-2008
nivas
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
Shell Programming and Scripting

I want to compare some files.

say iam having 2 sets of files ,each is having some 10 files.
ie,

file1
1a.txt
1b.txt
1c.txt
...
file2
2a.txt
2b.txt
2c.txt
...

i need to read line by line of this files parralley..


ie.. i want to read file1 first line that is 1a.txt and file2 first line (2a.txt) and pass this 2 input to comm command to compare .

this can in while loop ..so entire files have to pass for the compare command

Pls help to script.
  #2 (permalink)  
Old 02-20-2008
manikantants manikantants is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 131
paste file1 file2 > file3

while read one_line
do
first_file=`echo $one_line | awk '{ print $1 }'`
second_file=`echo $one_line | awk '{ print $2 }'`
comm -12 $first_file $second_file
done < file3

this may help you
  #3 (permalink)  
Old 02-20-2008
nivas
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
Thank you very much..it is working fine.

Thanks a lot.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:39 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0