note
BrowserUk
<blockquote><i></i></blockquote>
<p>The answers so far do not seem to have noticed the first line which also contains "SIL".
<P>This is pretty trivial using [mod://File::ReadBackwards]:<code>
#! perl -slw
use strict;
use File::ReadBackwards;
my $file = $ARGV[ 0 ];
tie *BW, 'File::ReadBackwards', $file;
my $lastpos = -s( $file );
while( <BW> ) {
last unless /SIL/;
$lastpos = tell( BW )
}
truncate $file, $lastpos;
close BW;
</code>
<p>A sample run:<spoiler><code>
C:\test>type junk35.dat
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 ?
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 ?
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
C:\test>junk35 junk35.dat
C:\test>type junk35.dat
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 ?
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 ?
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 ?
</code></spoiler>
<div class="pmsig"><div class="pmsig-171588">
<hr />
<font size=1 >
<div>With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'</div>
<div>Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.</div>
<div>"Science is about questioning the status quo. Questioning authority". </div>
<div>In the absence of evidence, opinion is indistinguishable from prejudice.
</div>
</font>
</div></div>
1027128
1027128