Delete line if next line is the same

That's what the uniq standard command is for.

uniq your-file

Note that some uniq implementations like GNU uniq will give you the first of a sequence of lines that sort the same (where strcoll() returns 0) as opposed to are byte-to-byte identical (where memcmp() or strcmp() returns 0). To force a byte to byte comparison regardless of the uniq implementation, you can force the locale to C with:

LC_ALL=C uniq your-file

Vim can achieve this nicely:

:g/\v^(.*\n)\1/d

Or if you'd rather use vim as a command line tool, you could do this as

vim file -c "g/\v^(.*\n)\1/d" -c "wq"

This way you don't have to wrestle with exiting vim later ;)

Explanation:

:g/

On all lines that match this regex...

\v^(.*\n)\1

Any line followed by itself...

/d

run the delete command (delete the current line). The -c "wq" is to save the changes and exit.