1.2.5 다섯 번째 명령 – sort
sort 명령은 파일에 담긴 각 줄을 오름차순(기본 설정)으로 정렬하는 명령이다.
chapter01 > command_5_sort
$ sort animals.txt
alpaca Intermediate Perl 2012 Schwartz, Randal
donkey Cisco IOS in a Nutshell 2005 Boney, James
horse Linux in a Nutshell 2009 Siever, Ellen
oryx Writing Word Macros 1999 Roman, Steven
python Programming Python 2010 Lutz, Mark
robin MySQL High Availability 2014 Bell, Charles
snail SSH, The Secure Shell 2005 Barrett, Daniel
-r 옵션을 사용하면 내림차순 정렬도 가능하다.
$ sort -r animals.txt
snail SSH, The Secure Shell 2005 Barrett, Daniel
robin MySQL High Availability 2014 Bell, Charles
python Programming Python 2010 Lutz, Mark
oryx Writing Word Macros 1999 Roman, Steven
horse Linux in a Nutshell 2009 Siever, Ellen
donkey Cisco IOS in a Nutshell 2005 Boney, James
alpaca Intermediate Perl 2012 Schwartz, Randal