首页 > 系统服务 > 详细

Linux 指令篇:文本排序--uniq(必须相邻)

时间:2014-04-25 05:23:51      阅读:562      评论:0      收藏:0      [点我收藏+]

NAME
    uniq - report or omit repeated lines

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

DESCRIPTION
    Filter adjacent matching lines from INPUT (or standard input), writing to OUTPUT (or standard output).

    With no options, matching lines are merged to the first occurrence.

    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.

    -u, --unique
      only print unique lines

================================================================================

e.g.1

[root@localhost tmp]# cat num.txt
111
111
667
999
111    /*此处与L1 L2不相邻 不作为重复统计*/


[root@localhost tmp]# uniq -d num.txt
111


[root@localhost tmp]# uniq -D num.txt
111
111


[root@localhost tmp]# uniq -c num.txt
2 111
1 667
1 999
1 111

Linux 指令篇:文本排序--uniq(必须相邻),布布扣,bubuko.com

Linux 指令篇:文本排序--uniq(必须相邻)

原文:http://www.cnblogs.com/CloudPing/p/3684747.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!