heidi has asked for the wisdom of the Perl Monks concerning the following question:
file1: TST_01 sp|123|fts TST_02 sp|3438|rvs TST_03 sp|2744|rtp file2: file1: sp|123|fts checked_proved sp|3438|rvs proven_right sp|2744|rtp un_proved desired result file: TST_01 sp|123|fts checked_proved TST_02 sp|3438|rvs proven_right TST_03 sp|2744|rtp un_proved
can any one help? thank you.#!/usr/bin/perl open(FH1,file1.txt); open(FH2,file2.txt); @array=<FH2>; while($var=<FH1>){ ($first,$second)=split("\t",$var); @grepped= grep ("$second",@array); print "$first\t@grepped\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: merging content based on common columns of 2 files using grep
by citromatik (Curate) on May 06, 2009 at 11:49 UTC | |
by heidi (Sexton) on May 06, 2009 at 15:04 UTC | |
|
Re: merging content based on common columns of 2 files using grep
by targetsmart (Curate) on May 06, 2009 at 11:07 UTC | |
by heidi (Sexton) on May 06, 2009 at 11:10 UTC | |
by Anonymous Monk on May 06, 2009 at 11:14 UTC | |
by Bloodnok (Vicar) on May 06, 2009 at 11:49 UTC | |
|
Re: merging content based on common columns of 2 files using grep
by planetscape (Chancellor) on May 07, 2009 at 03:29 UTC | |
|
Re: merging content based on common columns of 2 files using grep
by bichonfrise74 (Vicar) on May 06, 2009 at 21:43 UTC |