To be improved... sort: it is very efficient and powerful to implement the text sorting algorithm. the content of the original file is not modified. only the content output on the screen is modified. for example, sort/etc/fstab #-u removes duplicate rows. #-n sort by numerical value #-r sort in descending order example: head-n6/etc/passwd...
To be improved...
Sort: it is very efficient and powerful to implement the text sorting algorithm.
The content of the original file is not modified. only the content output on the screen is modified.
Example: sort/etc/fstab
#-U remove duplicate rows.
#-N sort by value
#-R sort in descending order
Example: head-n 6/etc/passwd | sort-r
Segment Separator
#-T specifies the segment separator
#-K sorting of specified segments
Example: head-n 6/etc/passwd | sort-t:-k 3
Uniq, sort-u
Uniq only recognizes duplicate rows and must be followed
Sort | uniq
Uniq-u only displays rows with no duplicates
-D: only duplicate rows are displayed.
-Row c appears several times
This article is from the "Wei's Linux bar" blog