Yes, it is necessary to see exactly what your file looks like. Could have saved some typing knowing that :-)
A possible solution is close to my first answer.
#!/usr/bin/perl
use strict;
use warnings;
{
local ($/, $\) = ('', "\n\n");
while (<DATA>) {
chomp;
print if tr/\n// > 1;
}
}
__DATA__
>Group 42
0 25ap, >name_06-T_1_0... at 92.00%
1 28ap, >name_06-T_1_0... *
>Group 43
0 28ap, >name_07-N_1_0... *
>Group 44
0 29ap, >name_07-N_1_0... *
>Group 45
0 25ap, >name_03-T_1_0... *
1 25ap, >name_06-T_1_0... at 100.00%
2 25ap, >name_07-N_1_0... at 100.00%
3 25ap, >name_11-N_1_0... at 100.00%
4 25ap, >name_14-T_1_0... at 100.00%
The statement
local ($/, $\) = ('', "\n\n");, sets the INPUT_RECORD_SEPARATOR, $/, to read in paragraphs. A paragraph is lines of text followed by 1 or more blank lines, (2 or more newlines). The OUTPUT_RECORD_SEPARATOR, $\, is set to
"\n\n". $\ is printed at the end of every print statement.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.