And this changes the last line and then prints it: perl -i -ne 's/foo/bar/ if eof; print $last = $_; END{print $last}' file
--
John.
In reply to Re: Replace Last Line in File
by jmcnamara
in thread search and replace last line
by kevinw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |