日期:2014-05-16 浏览次数:20695 次
[root@localhost tmp]# for i in {1..10}; do echo "$RANDOM $RANDOM $RANDOM"; done | sort -n > t [root@localhost tmp]# cat t 129 32444 4962 149 19841 3307 2327 21849 3066 4138 28425 21201 5076 20742 2021 11646 4268 18112 16553 16363 6218 21182 8495 26533 24534 8485 24987 29942 1816 4658 [root@localhost tmp]# awk 'BEGIN{10000*srand();} {printf "%s %s\n", rand(), $0}' t | sort -k1n | awk '{gsub($1FS,""); print $0}' 11646 4268 18112 4138 28425 21201 5076 20742 2021 21182 8495 26533 129 32444 4962 149 19841 3307 2327 21849 3066 24534 8485 24987 16553 16363 6218 29942 1816 4658 [root@localhost tmp]#