Remove duplicate lines using uniq

   

Display all the lines sorted in alphabetic order:

sort file_name

Now show only the unique lines:

sort file_name | uniq

And finally save the unique lines in a new file:

sort file_name | uniq > file_name_uniques

Related Articles

One Approved Response

  1. Ashley Says:

    Easy and simple step to remove duplicate lines.I think it will works great. By using uniq now we can easily delete the duplicate lines.

    Thanks for sharing..

Leave a Reply