Removing contiguous duplicate lines in vi without sorting

Posted by Dave Tapley on Stack Overflow See other posts from Stack Overflow or by Dave Tapley
Published on 2010-04-29T16:02:21Z Indexed on 2010/04/29 16:07 UTC
Read the original article Hit count: 312

Filed under:
|
|
|
|

This question already addresses how to remove duplicate lines, but enforces that the list is sorted first.

I would like to perform the remove contiguous duplicate lines step (i.e. uniq) without first sorting them.

Example before:

Foo
Foo
Bar
Bar

Example after:

Foo
Bar

© Stack Overflow or respective owner

Related posts about vi

Related posts about vim