garyboyd has asked for the wisdom of the Perl Monks concerning the following question:
Hi I am a perl newbie and have a real life problem that I am trying to solve:
I have a file with 4 columns of data:
HWUSI-EAS95L_0025_FC:3:1:5232:1082#0/1 - 1449586 1449619
HWUSI-EAS95L_0025_FC:3:1:5232:1082#0/2 - 1449544 1449577
HWUSI-EAS95L_0025_FC:3:1:6417:1078#0/1 - 4744083 4744113
HWUSI-EAS95L_0025_FC:3:1:6539:1083#0/1 - 4867122 4867157
HWUSI-EAS95L_0025_FC:3:1:6539:1083#0/2 - 4866942 4866977
HWUSI-EAS95L_0025_FC:3:1:10260:1083#0/1 + 1930232 1930266
HWUSI-EAS95L_0025_FC:3:1:10260:1083#0/2 + 1930354 1930389
I would like to be able to match the lines within the first column based on name
ie
HWUSI-EAS95L_0025_FC:3:1:5232:1082#0/1 and HWUSI-EAS95L_0025_FC:3:1:5232:1082#0/2
belong together and then parse out information (1449586) from column 3 for the first line
and (1449577) column 4 for the matched second line.
Where there is no matched pair eg HWUSI-EAS95L_0025_FC:3:1:6417:1078#0/1
I want to skip onto the next line and look to see if there is another matched
pair.
Any pointers would be appreciated.
Thanks
Gary
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: compare lines within a file
by kennethk (Abbot) on Mar 09, 2011 at 17:35 UTC | |
by garyboyd (Acolyte) on Mar 10, 2011 at 08:32 UTC | |
by garyboyd (Acolyte) on Mar 10, 2011 at 08:37 UTC | |
by kennethk (Abbot) on Mar 10, 2011 at 15:29 UTC | |
by garyboyd (Acolyte) on Mar 11, 2011 at 13:56 UTC | |
| |
|
Re: compare lines within a file
by wind (Priest) on Mar 09, 2011 at 17:26 UTC |