Here's the snippet I ended up with - it's not much more than verbatim from plaid's answer.

Ovid's answer looked interesting too, but I try not to take things from people on crack.   <big grin>

Update: Thanks as well to other fine Monks who offered answers.
    cheers,
    ybiC

#!/usr/bin/perl -w # parse a log file and move lines with important text to top # of file while keeping sequence within each of two sections: # important and not-so-important use strict; my $infile = '/dir/file.in'; my $outfile = '/dir/file.out'; my @important; my @normal; open IN, "$infile" or die "Couldn't open $infile"; open OUT, ">$outfile" or die "Couldn't open $outfile"; while (<IN>) { s/unwanted text//g; # strip unwanted text s/more unwanted text//g; # strip unwanted text s/^\s+//g; # remove empty lines (/important text/) ? push @important, $_ : push @normal, $_; } print OUT @important; print OUT @normal; close IN or die "Couldn't close $infile"; close OUT or die "Couldn't close $outfile"; # END

In reply to RE: text sorting question, kinda (simple result) by ybiC
in thread text sorting question, kinda by ybiC

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.