使用例 :
[root@localhost ~]# cat test.txt
Tokyo:February 01
Hiroshima:December 005
Osaka:November 003
hokkaido:July 002
kyoto:August 04
[root@localhost ~]# sort test.txt
Hiroshima:December 005
hokkaido:July 002
kyoto:August 04
Osaka:November 003
Tokyo:February 01
[root@localhost ~]# sort -k2 test.txt
hokkaido:July 002
Osaka:November 003
Hiroshima:December 005
Tokyo:February 01
kyoto:August 04
[root@localhost ~]# sort -k2 -g test.txt
Tokyo:February 01
hokkaido:July 002
Osaka:November 003
kyoto:August 04
Hiroshima:December 005
[root@localhost ~]# sort -t':' -k2 test.txt
kyoto:August 04
Hiroshima:December 005
Tokyo:February 01
hokkaido:July 002
Osaka:November 003
[root@localhost ~]# sort -t':' -k2M test.txt
Tokyo:February 01
hokkaido:July 002
kyoto:August 04
Osaka:November 003
Hiroshima:December 005
|