日期:2014-05-16 浏览次数:20855 次
[tom@jerry ~]$ for i in {1..10}; do echo "$RANDOM $RANDOM $RANDOM" ; done | sort -n > t [tom@jerry ~]$ cat t 2175 29691 11032 12162 61 20919 15727 3485 27566 19868 23872 11314 21872 15024 14443 22493 24397 32577 26515 1290 5478 27103 18544 14095 28782 15152 7987 31916 20058 20247 [tom@jerry ~]$ awk 'BEGIN{ 100000*srand();}{ printf "%s %s\n", rand(), $0}' t |sort -k1n | awk '{gsub($1FS,""); print $0}' 15727 3485 27566 31916 20058 20247 26515 1290 5478 19868 23872 11314 2175 29691 11032 27103 18544 14095 28782 15152 7987 21872 15024 14443 22493 24397 32577 12162 61 20919 [tom@jerry ~]$