How to remove duplicated lines in a file Commands Add comments Jan 022010 How to remove duplicated lines in a file Answer: Use the following command sort test.txt | uniq Related posts: How to count the number of duplicated lines in a file Remove empty lines in a file Remove comments (#) and empty lines in a file Remove specified lines from a file using sed Join lines on a common field Leave a Reply Cancel reply Name (required) E-mail (required) URI Your Comment You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>