> my @x = <FH>; > @x = @x[($#x-100>0?$#x-100:0)..$#x];
This will read in the whole log, quite inefficient if your log files are big..
Consider this:
</code>open LOG,"<","/some/log" or die $!; seek LOG,-50000,2; # go to 50K from the end (assuming your log-lines +have 500 or less characters) my @lines = <LOG>; # get all from there splice @lines => 0, -100; # see [Abigail-II]'s comment close LOG; print @lines;
-- Joost downtime n. The period during which a system is error-free and immune from user input.
In reply to Re: Re: Reading Log file from bottom up and take first 100 lines and send email...
by Joost
in thread Reading Log file from bottom up and take first 100 lines and send email...
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |