Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

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


Comment on Re: removing lines that are in the end of a file
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1027139]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (15)
As of 2014-12-17 21:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (34 votes), past polls