Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: removing lines that are in the end of a file

by thundergnat (Deacon)
on Apr 05, 2013 at 13:59 UTC ( #1027139=note: print w/replies, xml ) Need Help??

in reply to removing lines that are in the end of a file

If it is exactly that line in every file, and not just "the first value larger than 8" y You could just play games with the input record separator.

UPDATE: Sorry, misread question. Changed program. Note that your data set has a line that ends in "SIL" before the one you highlighted in red. If you want everything up to the SECOND line ending in "SIL" just repeat the "print" line.

{ local $/ = "SIL\n"; #open my $in, '<', $whatever or die "$!"; #open my $out, '>', $output or die "$!"; #print $out scalar <$in>; print scalar <DATA> for 1..2; } __DATA__ 0.642375 125 SIL 1.0705 125 ઔર્ 1.3651875 125 આત્ 1.519875 125 મ ... ... ... 7.2140627 125 સે 7.478125 125 હટ્ 7.622625 125 જા 7.956125 125 ઓ 8.192375 125 SIL 8.252 125 SIL 8.464 125 SIL 8.706 125 SIL

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1027139]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2017-12-16 23:09 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (459 votes). Check out past polls.