排序-R命令不会在Linux中随机排序线 [英] The sort -R command doesn't sort lines randomly in Linux
本文介绍了排序-R命令不会在Linux中随机排序线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不能让--random排序与Fedora Linux系统的系统上sort命令工作。
一些背景资料:
$猫的/ etc / Fedora的释放
Fedora的这次发行7(月光)
$哪种类型
/斌/排序
$男人排序| grep的-A 2'\\ -R
-R,--random排序
排序键随机哈希$男人排序| grep的-A 3'\\ -R
-R,--random排序
排序键随机哈希 --random源= FILE
和测试:
$回声-e2 \\ N1 \\ N3 \\ N5 \\ N4
2
1
3
五
4
$回声-e2 \\ N1 \\ N3 \\ N5 \\ N4|排序-r#逆向排序
五
4
3
2
1
$回声-e2 \\ N1 \\ N3 \\ N5 \\ N4|排序-R#排序按随机顺序
1
2
3
4
五
$#失败!这不是随机的(我已经尝试过多次。)
解决方案
那一定是在学校出现故障的安装。
I can't get --random-sort to work with the sort command on a Fedora Linux-system.
Some context information:
$ cat /etc/fedora-release
Fedora release 7 (Moonshine)
$ which sort
/bin/sort
$ man sort | grep -A 2 '\-R'
-R, --random-sort
sort by random hash of keys
$ man sort | grep -A 3 '\-R'
-R, --random-sort
sort by random hash of keys
--random-source=FILE
And the test:
$ echo -e "2\n1\n3\n5\n4"
2
1
3
5
4
$ echo -e "2\n1\n3\n5\n4" | sort -r # Sort in reverse order
5
4
3
2
1
$ echo -e "2\n1\n3\n5\n4" | sort -R # Sort in random order
1
2
3
4
5
$ # Fail! That's not random (I've tried it multiple times.)
解决方案
It must have been a faulty installation in school.
这篇关于排序-R命令不会在Linux中随机排序线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文