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
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|