Friday, August 03, 2001

Finding Duplicate Lines in file ...

uniq file-name

There are some options you can give to uniq:

  1. -c will count the number of repetitions of lines
  2. -d will do the "opposite" of the normal behaviour, namely will print out only the duplicate lines
  3. -i will ignore cases during comparison

You can use this command to get unique lines in the output of other commands as in the case of sort.

No comments: