in reply to pattern matching only last line of a file and then copy 10 lines above till end

You could use Tie::File. That let's you think of your file as an array. The last line is the last element in the array. It would look something like this:
use Tie::File; my @array; tie @array, 'Tie::File', filename or die ...; if ( $array[-1] =~ /regex here/ ) { # print elemeents -10 to -1. }
Phil
  • Comment on Re: pattern matching only last line of a file and then copy 10 lines above till end
  • Download Code

Replies are listed 'Best First'.
Re^2: pattern matching only last line of a file and then copy 10 lines above till end
by holli (Abbot) on Oct 20, 2005 at 15:58 UTC