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


In reply to compare lines within a file by garyboyd

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.