Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: How can I grab the last 2 lines of a file?by fishmonger (Chaplain) |
on Jul 26, 2014 at 23:09 UTC ( [id://1095185]=note: print w/replies, xml ) | Need Help?? |
Normally, I'd suggest a pure Perl solution, such as the one AppleFritter suggested but in this case I'll suggest a mixed perl/shell solution that needs only 1 line of code. my ($id, $name) = split {$/}, `tail -2 /path/to/file`;
In Section
Seekers of Perl Wisdom
|
|