Question: 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.

Answer: 
To remove for example the 4th line from the bottom using `sed`:

```
tac input | sed '4d' | tac

```

To overwrite the input file:

```
tmpfile=$(mktemp)
tac input | sed '4d' | tac > "$tmpfile" && mv "$tmpfile" input

```
This is tagged with `sed` and `awk` but the question doesn't mention these as being required for the solution. Here's a Perl filter which removes the 4th-from-last line and prints the result. The output can written to a tmp file and then used to replace the original.

```
 perl -e '@L = <STDIN>; splice(@L,-4,1); print @L' ./lines.txt

```