gudii9
asked on
sort vs sort -n
hi,
what is difference between
sort vs sort -n vs sort -M vs sort -rM
please advise
what is difference between
sort vs sort -n vs sort -M vs sort -rM
please advise
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
bash-4.4$ ls -ltr
total 8
-rw-r--r-- 1 13381 13381 978 Nov 9 20:39 README.txt
-rw-r--r-- 1 13381 13381 0 Nov 9 20:39 xyz.txt
-rw-r--r-- 1 13381 13381 24 Nov 9 20:40 xyx.txt
-rw-r--r-- 1 13381 13381 0 Nov 9 21:30 errors.txt
bash-4.4$ sort
i tried as above here
https://www.tutorialspoint.com/unix_terminal_online.php
i see it is taking forever to give result
please advise
total 8
-rw-r--r-- 1 13381 13381 978 Nov 9 20:39 README.txt
-rw-r--r-- 1 13381 13381 0 Nov 9 20:39 xyz.txt
-rw-r--r-- 1 13381 13381 24 Nov 9 20:40 xyx.txt
-rw-r--r-- 1 13381 13381 0 Nov 9 21:30 errors.txt
bash-4.4$ sort
i tried as above here
https://www.tutorialspoint.com/unix_terminal_online.php
i see it is taking forever to give result
please advise
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
-M
Sort by month abbreviations. Unknown strings are considered smaller than the month names.
-n
Sort fields numerically by arithmetic value. Fields are supposed to have optional blanks in the beginning, an optional minus sign, zero or more digits
(including decimal point and possible thousand separators).
-r
Sort in reverse order.
e.g.
(echo "Jan"; echo "Feb"; echo "Mar"; echo "1"; echo "11"; echo "2"; echo "22") | sort
(echo "Jan"; echo "Feb"; echo "Mar"; echo "1"; echo "11"; echo "2"; echo "22") | sort -n
(echo "Jan"; echo "Feb"; echo "Mar"; echo "1"; echo "11"; echo "2"; echo "22") | sort -M
(echo "Jan"; echo "Feb"; echo "Mar"; echo "1"; echo "11"; echo "2"; echo "22") | sort -rM