How do I remove duplicate lines in files?

How do I remove duplicate lines in files?
Answer
The uniq command
is used to remove duplicate lines from a text file in Linux. By default, this command discards all but the first of adjacent repeated lines, so that no output lines are repeated. Optionally, it can instead only print duplicate lines. For uniq to work, you must first sort the output.
 

Tìm kiếm

Back
Top