I have been reading through the sed one liners, trying to understand what is happening.
# delete the last 2 lines of a file
sed 'N;$!P;$!D;$d'
The above will delete the last 2 line of a file. I tried analyzing what happens. And I got lost
This is what I understood so far from the above.
N; Read the complete file into the pattern-space.
$!P; Print upto last but one line.
$!D; Delete upto the last-but one line
$d Delete the last line in the pattern-space.
What is wrong in my analysis ? Please explain what the sed script does ?
Thanks,
Vino