Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

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

by thundergnat (Deacon)
on Apr 05, 2013 at 13:59 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-04-19 22:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found