Command: Sort
Option:-t:-kn Specifies that the order is sorted according to a segment here N represents a number, the range specifies n,n. range from N to n
-N in numerical order
-R Reverse Order
-U go to repeat sort
-un numbers are ordered and repeated, and the system considers the letters to be repeated, taking only the first letter string in the document.
Description: Sort, no options are arranged in Asma order.
No Add option
[Email protected] ~]# SORT/ETC/PASSWD
Adm:x:3:4:adm:/var/adm:/sbin/nologin
Aming:x:502:502::/home/aming:/bin/bash
Avahi-autoipd:x:170:170:avahi Ipv4ll Stack:/var/lib/avahi-autoipd:/sbin/nologin
Bin:x:1:1:bin:/bin:/sbin/nologin
Daemon:x:2:2:daemon:/sbin:/sbin/nologin
......
/////////////////////////////////////////////////////////////////////////
-T:-k3
[Email protected] ~]# sort-t:-k3/etc/passwd
Root:x:0: 0:root:/root:/bin/bash
Uucp:x:14:uucp:/var/spool/uucp:/sbin/nologin
OPERATOR:X:0:operator:/root:/sbin/nologin
Bin:x:1: 1:bin:/bin:/sbin/nologin
Games:x:100:games:/usr/games:/sbin/nologin
GOPHER:X:30:gopher:/var/gopher:/sbin/nologin
Ftp:x:14:FTP User:/var/ftp:/sbin/nologin
////////////////////////////////////////////////////////////////////
-N
[Email protected] ~]# sort-t:-k3-n/etc/passwd
Root:x:0: 0:root:/root:/bin/bash
Bin:x:1: 1:bin:/bin:/sbin/nologin
Daemon:x:2: 2:daemon:/sbin:/sbin/nologin
ADM:X:3: 4:adm:/var/adm:/sbin/nologin
LP:X:4: 7:lp:/var/spool/lpd:/sbin/nologin
SYNC:X:5: 0:sync:/sbin:/bin/sync
Shutdown:x:6: 0:shutdown:/sbin:/sbin/shutdown
.......
////////////////////////////////////////////////////////////////////////////
-T:-kn,n For example 3,5 refers to the 3rd paragraph to the 5th paragraph
[Email protected] ~]# sort-t:-k3,5-n/etc/passwd
Root:x:0:0:root:/root:/bin/bash
Bin:x:1:1:bin:/bin:/sbin/nologin
Daemon:x:2:2:daemon:/sbin:/sbin/nologin
Adm:x:3:4:adm:/var/adm:/sbin/nologin
Lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
.......
////////////////////////////////////////////////////////////////////////////////////
-R
[Email protected] ~]# Sort-rn 2.txt
7
6
5
4
3
2
2
1
1
Ac
Ab
Aa
A
/////////////////////////////////////////////////////////////////////////////////////
-U
[Email protected] ~]# sort-u 2.txt
1
2
3
4
5
6
7
A
Ab
Ac
Aa
/////////////////////////////////////////////////////////////////////////
-un
[Email protected] ~]# Sort-un 2.txt
A
1
2
3
4
5
6
7
////////////////////////////////////////////
Summary: sort-t:-kn//-N//-R//-U//-un
Shell Getting Started-sort sort