- Learning Linux Shell Scripting
- Ganesh Naik
- 102字
- 2021-06-25 22:02:50
The uniq command
The following are a few examples showing the usage of the uniq command:
- This command removes duplicate adjacent lines from the file:
$ cat test aa aa cc cc bb bb yy zz $ uniq test
- This output removes the duplicate adjacent lines from test file, shown as follows:
aa cc bb yy zz
- The next command only prints duplicate lines:
$ uniq -d test
- Output:
aa cc bb
- The following command prints the number of occurrences of all elements on an inpidual line:
$ uniq -c test
- Output:
2 aa 2 cc 2 bb 1 yy 1 zz
推薦閱讀
- 腦動力:Linux指令速查效率手冊
- Hands-On Artificial Intelligence on Amazon Web Services
- 輕松學Java
- Hands-On Data Science with SQL Server 2017
- Security Automation with Ansible 2
- 計算機網絡應用基礎
- 電腦上網直通車
- 精通Excel VBA
- Photoshop CS3特效處理融會貫通
- PostgreSQL Administration Essentials
- 大學計算機應用基礎
- 完全掌握AutoCAD 2008中文版:綜合篇
- 大數據技術與應用
- Grome Terrain Modeling with Ogre3D,UDK,and Unity3D
- Statistics for Data Science