Sort-command alphanumeric
If they all actually begin with “page$”
echo "page$1 page$20 page$2 page$10" | sort -k1.5n
Answer :
page$1 page$2 page$10 page$20
sort -k1.5n
-k to set the key
1.5 means that the 5th character of the 1st field is the start of the sort field
n means that this field is to be treated as numeric
n means that this field is to be treated as numeric
Sample Commands
sort -k 5 -n sort -t ":" -k 3 -n /etc/psswd