Uniq


From Linuxconfig.org

Jump to: navigation, search

.. back to the list of Linux Commands

Name

uniq - report or omit repeated lines

Synopsis - man page

uniq [OPTION]... [INPUT [OUTPUT]]

Frequently used options

-i, --ignore-case
      ignore differences in case when comparing
-u, --unique
      only print unique lines

Examples

Suppose we have a file with content:

$ echo -e "a\nb\nA\nc\nd\nc\nE\ne" > file
Image:uniq01.gif

unig command will print only unique lines within file:

NOTE: Only consecutive lines counts as NOT unique.

$ uniq file
Image:uniq02.gif

Ignore differences in case when comparing a file:

$ uniq -i file
Image:uniq03.gif

.. back to the list of Linux Commands

Personal tools
Linux Commands