How to use sort and uniq command in Linux
This article mainly writes the use of some shell script sort and uniq tools in Linux environments.
Sort command
Sort is a tool for sorting the contents of files in units of lines, and can also be sorted according to different data types.
Use
Example
Sort the accounts in the /etc/passwd file

sort -t ‘:’ -k 3 /etc/passwd -o user.txt
uniq command
The uniq tool is usually used in conjunction with the sort command to report or ignore duplicate lines in the file.
Use
Example




