Extract the 2nd and 3rd column, and write them to a new file:

use strict; use warnings; open my $APRI2_in, '<', 'path_to_infile.txt' or die $!; open my $out_fh, '>', 'path_to_outfile.txt' or die $!; while( <$APRI2_in> ) { my @columns = split /\t/, $_; print $out_fh "$columns[1]\t$columns[2]\n"; } close $APRI2_in; close $out_fh or die $!;

...or as a one-liner...

perl -plaF/\t/ -e '$_ = "$F[1]\t$F[2]"' infile > outfile

Dave


In reply to Re: multicolumn extraction by davido
in thread multicolumn extraction by Anto_ch

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":