There are unknown number of lines in a file. How to delete nth line (when counted from the bottom) with one-liner command (you may use more than one if it is necessary) on Unix platform.
Delete nth line (when counted from the bottom)
awkperlsed
awkperlsed
There are unknown number of lines in a file. How to delete nth line (when counted from the bottom) with one-liner command (you may use more than one if it is necessary) on Unix platform.
Best Answer
To remove for example the 4th line from the bottom using
sed
:To overwrite the input file: