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: 
Neither standard `sed` nor `awk` support editing in place.

For that, you better use `ed(1)` or `ex(1)`:

```
printf '$-%dd\nw\n' 1 | ed -s your_file

```

Or with here-doc

```
ed -s <<'EOT' your_file
$-1d
w
EOT

```

With advanced shells like `bash`, `zsh` or`ksh93` you can use the `$'...'` syntax and here-strings:

```
ed -s <<<$'$-1d\nw' your_file 

```

Notice that the `$` address means the last line from the file; so the index 1 there is **0-based**; for the 1st line from the end replace the 1 with 0 (`$-0`), for the 3nd with 2 (`$-2`), etc.

Putting it in a function:

```
del_nth_line_from_end(){ printf '$-%dd\nw\n' "$(($2-1))" | ed -s "$1"; }

```

Instead of `ed -s` you can use `ex -s` or `vim -es` everywhere.
An one-line, in-place solution:

With `gawk`, this will delete the 42nd line from the bottom:

```
gawk -i inplace 'i==0 {if(FNR>t){t=FNR}else{i=1}} i==1 && FNR!=t-42 {print}' input input

```

The 42 can be replaced with any number. If 0 is used then the last line is deleted.

Notice that the `input` file is specified twice. This forces two iterations of the file with gawk. In the first iteration (`i==0`) the total number of lines (`t`) is established. In the second iteration, the nth line from the end is not output.

The file is modified in place by using the `-i` option.