博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Linux中对为本去重
阅读量:4325 次
发布时间:2019-06-06

本文共 1517 字,大约阅读时间需要 5 分钟。

1.格式

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

2.命令

-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       -z, --zero-terminated              end lines with 0 byte, not newline       -w, --check-chars=N              compare no more than N characters in lines       --help display this help and exit       --version              output version information and exit

3.举例子

unique.txt

hellopythonhellopythonpythonbbs.pythontab.compythonpythontab.compythonhello.pythontab.comhellopythontabhellopythontab

(1)执行 uniq unique.txt

hellopythonpythonbbs.pythontab.compythonpythontab.compythonhello.pythontab.comhellopythontab

(2)看了上面是不是感觉不对呢?再执行uniq -c unique.txt

2 hellopython1 python1 bbs.pythontab.com1 python1 pythontab.com1 python1 hello.pythontab.com2 hellopythontab1#感觉还是不对,uniq检查重复行时,是按相邻的行进行检查的#

(3)再执行sort unique.txt | uniq -c

11 bbs.pythontab.com2 hellopython2 hellopythontab3 python1 pythontab.com1 hello.pythontab.com

---------------------

EOF

转载于:https://www.cnblogs.com/sxmcACM/p/4040709.html

你可能感兴趣的文章
seL4环境配置
查看>>
Git报错:insufficient permission for adding an object to repository database .git/objects
查看>>
ajax跨域,携带cookie
查看>>
BZOJ 1600: [Usaco2008 Oct]建造栅栏( dp )
查看>>
洛谷 CF937A Olympiad
查看>>
Codeforces Round #445 C. Petya and Catacombs【思维/题意】
查看>>
用MATLAB同时作多幅图
查看>>
python中map的排序以及取出map中取最大最小值
查看>>
ROR 第一章 从零到部署--第一个程序
查看>>
<form>标签
查看>>
vue去掉地址栏# 方法
查看>>
Lambda03 方法引用、类型判断、变量引用
查看>>
was集群下基于接口分布式架构和开发经验谈
查看>>
MySQL学习——MySQL数据库概述与基础
查看>>
ES索引模板
查看>>
HDU2112 HDU Today 最短路+字符串哈希
查看>>
JPanel重绘
查看>>
图片放大器——wpf
查看>>
SCALA STEP BY STEP
查看>>
cocos2d-x学习笔记
查看>>