The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 03-07-2009
InfoSeeker InfoSeeker is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 2
Post Not sure how to use diff and comm for my problem

Hello,
Apologies if this question has been repeated before, but I am getting myself confused even more as I scan the posts!

I have two files, file1 is a column:
1dlwa_
1s69a_
1idra_
1ngka_

And file2 has three columns (columns seperated by tabs):
1dlw a_ A
1uvy a_ A
1dly a_ A
1uvx a_ A
1s69 a_ A

I want to only extract from file2 those rows where the first & second column concatenated together matches the first column of file1. In this example above, I would only want to see:
1dlw a_ A
1s69 a_ A

And I want to save these in a new file, file3. How would I use diff, comm, or any combination of those to do it?
Thank you in advance for your help!
InfoSeeker