Saturday, July 4, 2009

Remove duplicate lines from vi editor

In order to remove all duplicate lines (rows) from a file which is opened in vi editor,

Use the following command

:sort u

which will sort all lines and remove duplicates and will keep only unique lines.
Other solutions for removing duplicate lines from vi editor can be found here

Related posts:
- Remove duplicate consecutive fields or lines from file
- Remove duplicate blank lines using awk in bash
- Remove duplicates based on fields using awk
- Remove duplicate lines without sorting file using awk

No comments:

© Jadu Saikia