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

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
comparing of two files with output which is not in both files suryanarayana Shell Programming and Scripting 2 02-04-2009 08:41 AM
Need Help Comparing two Files awknerd Shell Programming and Scripting 4 09-03-2008 01:24 AM
Comparing two files superstar003 Forum Support Area for Unregistered Users & Account Problems 1 05-08-2008 04:34 AM
Comparing 2 files hdixon UNIX for Dummies Questions & Answers 2 08-01-2007 01:24 PM
comparing shadow files with real files terrym UNIX for Advanced & Expert Users 4 02-09-2007 02:38 AM

 
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
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 09-28-2009
genehunter genehunter is offline
Registered User
  
 

Join Date: May 2009
Posts: 17
Comparing two files

Hello all, I am not a programmer, but I require a little help with a project I am doing. I did read several posts and looks like awk or python may help me, though I know very little about using them. Here is my question: I have first file with 6 column.

Code:
CHR             SNP   A1   A2          MAF  NCHROBS
    0   SNP_A-8414268    A    G       0.1522     5354
   1      rs12565286    C    G      0.04139     5340
   1       rs2980319    A    T       0.1503     5362
   1       rs2980300    T    C       0.1773     5346
   1       rs6603781    A    G       0.1149     5346

My second file is very similar to the first one, but it may or may not have the same Column 2(SNP). I suspect that the columns Col 3 and 4 (A1 & A2) may be different as well.

What I require is to get an output file with columns 1,2,3, 4, 5, 6 from the first file and the corresponding line that matches column 2 (SNP) of the FIRST file with the columns 2,3,4,5,6 (SNP, A1, A2, MAF, NCHROBS) from SECOND file at positions 7,8,9,10,11,2. The output file will hence have 11 columns; the first 6 from file 1.txt and the matching last five from file 2.txt

Code:
CHR             SNP   A1   A2          MAF  NCHROBS
       0   SNP_A-8414268    A    G       0.1522     5354
   1      rs12565286    C    G      0.04139     5340
   1       rs2980319    A    T       0.1503     5362    rs2980319    A    T       0.1503     4252
   1       rs2980300    T    C       0.1773     5346    rs2980300    T    C       0.1273     4546
   1       rs6603781    A    G       0.1149     5346    rs6603781    G    A       0.0249     4546

Thank you for reading
 

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 08:20 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