uniq command

The uniq command is used to remove duplicate lines from a sorted file. It requires the duplicate entries to be in the adjacent lines and, hence, it is mostly used in combination with the sort command, which is used to sort the file contents first. The syntax of the uniq command is as follows:

$ sort <filename> | uniq
or
$ sort -u <filename>

To count duplicate lines in the file, execute the command line, shown as follows :

$ sort <filename> | uniq -c

To display only the entries that are duplicates, execute the command line, shown as follows:

$ sort <filename> | uniq -cd
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.147.193