Linux命令--uniq

来源:互联网 发布:德稻全球创新网络 编辑:程序博客网 时间:2024/06/11 19:41

uniq命令可以输出文本文件的内容,并且令文本文件中连续的相同的行只输出一次(也可以都输出)、可以只输出有重复连续的行、只输出没有重复连续的行等功能。

 

具体用法如下:

NAME
       uniq - report or omit repeated lines

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

DESCRIPTION
       Discard  all  but  one of successive identical lines from INPUT (or standard input), writing to OUTPUT (or standard out-
       put).

       Mandatory arguments to long options are mandatory for short options too.

       -c, --count
              prefix lines by the number of occurrences

       -d, --repeated
              only print duplicate lines

       -D, --all-repeated[=delimit-method] print all duplicate lines
              delimit-method={none(default),prepend,separate} Delimiting is done with blank lines.

       -f, --skip-fields=N
              avoid comparing the first N fields

       -i, --ignore-case
              ignore differences in case when comparing

       -s, --skip-chars=N
              avoid comparing the first N characters

       -u, --unique
              only print unique lines


       -w, --check-chars=N
              compare no more than N characters in lines

       --help display this help and exit

       --version
              output version information and exit

       A field is a run of whitespace, then non-whitespace characters.  Fields are skipped before chars.

 

原创粉丝点击