in reply to Request for comments/ clues on simple text manipulation script
# Your count and letters declarations here my $accum; my $banner; while (<>) { if (/^L/i) { if ($banner) { print $banner, 'tstat propmean;elms=', @letters[0..$count- +1], "\n", $accum; } $banner = $_; $accum = ''; $count = 0; } elsif (/^N01/i) { s/\n/;ID=$letters[$count]\n/; ++$count; $accum .= $_; } else { $accum .= $_ } } print $banner, 'tstat propmean;elms=', @letters[0..$count-1], "\n", $a +ccum;
|
|---|