The description of the problem makes sense, but your guess about having a loop inside a loop is very muddled. And you still haven't shown any of your own code.

By way of a better explanation, your solution should be something called a "state machine", where at any given time your program is in one of a finite set of "states" (it seems like two states will suffice here). Whether or not you print a given line depends on what state you're in, and there are certain lines that will cause a change of state. Make sense? Here's pseudo-code, which is pretty close to a perl solution:

initial state is "0"; while there's a line that you've read from the file { set state to "1" if the current line contains "HW/OS/Client" print the current line if the current state is "1" (true) set state to "0" if the current line is blank (contains only white-sp +ace) }
That should do what you want. Let us know if you have trouble turning that into perl code. (It shouldn't be hard.)

In reply to Re^4: How to print certain lines out of a text file. by graff
in thread How to print certain lines out of a text file. by sawdustar

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.