I have a tab-delimited information file, e.g.:
THAETURQU .LLL..RRR JURYATAUTIOPW .LLL...LL.RRR TURIWOWQNQQUTYRIOPWMNHF L..L..LLLL.LL.R..L.LLLL
I would really like to be able to pick out the letters from column 1 that correspond to specific combinations from the string in column 2. e.g. for ".LLL"
THAETURQU .LLL..RRR THAE JURYATAUTIOPW .LLL...LL.RRR JURY TURIWOWQNQQUTYRIOPWMF L..L..LLL.LL.R..L.LLL OWQN,PWMF
Is there an easy way to provide a list of combinations, such as a file:
.LLL LLLL .RRR RRRR
that would output the corresponding letters in from column 1 in subsequent columns headed, ".LLL", "LLLL", ".RRR", "RRRR"?

I suspect this is really simple, but it would be really helpful, thanks!


In reply to Extracting string based on comparison to second string? by trudy123g

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.