Hi all. I have this file
Processing 12312 2343434 34344 Processing 12123 34343 Processing 12443 3434 3434 23434 Processing 1213 33434 Processing 96668 343 Processing 667 343 3437 Processing 67 63 47 7 Processing 6 667 23434 343 3434 Processing 88668
What I want is to go through this list in a selection of three.

1. After the first occurrence pattern "Processing" i have 3 lines.Save these three lines in a separate file.save the file size of this file in variable "a"

2. After 2nd occurrence of "Processing", I have 2 lines.Save these 2 lines in a separate file.save the file size of this file in variable "b"

3. After 3rd occurrence of "Processing", I have 4 lines.Save these 4 lines in a separate file.save the file size of this file in variable "c"

Now I'd perform an operation $a+$b/$c >> RESULT.txt.

Then select other triplet i.e. 4th,5th and 6th occurence of "Processing" save tyhe calculation to RESULT.txt and so on


In reply to Simultaneous one by one splitting and processing of an uneven file based on a pattern by zing

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.