So this is a sample of the data set I am working with:

Frame: 11 Dist: 3.9167561146736 Pair: C3 3.758637 0.476092 -0.993460000000001 C3 0 0 0 C5 -1.869251 0.768024 1.474533 C6 -2.190815 0.66446 -1.008485 C3 3.758637 0.476092 -0.993460000000001 C5 5.761172 1.640144 -0.0484530000000003 C6 4.954926 -0.500627 0.974567 Frame: 12 Dist: 3.53249125062413 Pair: C3 3.525636 0.219958 0.00192600000000098 C3 0 0 0 C5 -1.36273 0.727707000000001 1.967642 C6 -2.447943 0.437720000000001 -0.272385999999999 C3 3.525636 0.219958 0.00192600000000098 C5 5.570011 1.364399 0.87885 C6 4.824893 -0.811070999999998 1.874659

I need to extract the number of lines containing 'C' following each line containing 'Frame'. I have absolutely no idea how to begin coding this (I am super new to perl).

I am hoping to get an output that looks something like: Frame: 11 7 (number of lines containing C)

Help?


In reply to Counting lines matching a certain pattern following a select word by moon36

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.