tr5
asked on
Need sed script to remove last line from file.
Hi
I need a sed script (or other) to remove the last line from a file and to resave to the same file.
Thanks
tr5
I need a sed script (or other) to remove the last line from a file and to resave to the same file.
Thanks
tr5
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Which is quicker / more efficient? I need to do it often.
Both should have comparable performance since both scan input for lines. Head might be slightly more efficient since this is the job it is built for - displaying specific lines.
ASKER
Thanks
sed '$d' infile > tempfile
mv tempfile infile