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
Comparing two files ragavhere Shell Programming and Scripting 32 12-04-2008 01:24 PM
Comparing two txt files - pls help jisha Shell Programming and Scripting 5 01-23-2008 04:14 AM
Comparing two files.. padarthy Shell Programming and Scripting 1 08-29-2007 08:01 AM
comparing shadow files with real files terrym UNIX for Advanced & Expert Users 4 02-09-2007 02:38 AM
comparing two files using awk. jerome Sukumar Shell Programming and Scripting 4 11-22-2006 06:27 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-31-2008
awknerd awknerd is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 19
Exclamation Need Help Comparing two Files

I really need help on creating a script that does the following:

I have one file (File 1) with lines in the following format:

Name.maf score1 score2


I have a second file (File 2) with lines in the following format:

label start end Name

What I need to do is compare File 1 and File 2. When the Name matches, then I need to add the "label, "start" and "end" column's value of File 2 to the 2nd, third and fourth column of File 1 to get

Output

Name.maf label start end score1 score2

The trick here too is that what needs to match is only the Name, not the entire Name.maf. e.g. hello.maf and hello would be Name matches.

Any help would be very much appreciated! Thanks!

Last edited by awknerd; 08-31-2008 at 06:50 PM..
  #2 (permalink)  
Old 09-01-2008
Annihilannic Annihilannic is offline Forum Advisor  
  
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 1,009
Try searching this site for 'NR==FNR' and you should see many posts with similar requirements.
Sponsored Links
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 10:05 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
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