使用bash或awk随机改组行

时间:2015-12-24 18:28:25

标签: bash awk

我需要使用AWK / BASH随机化一个csv数据文件。即随机播放文件中的每一行。字段1中增加的行号不存在于我的实际数据文件中。我已经包含了这个来演示After数据集。关于如何实现这一目标的任何建议都将受到极大欢迎。

在:

1, asdasd,34534,sdfsdf,456,sdsdfsd,36345,asdaa
2, ghjghj,34534,ert,3456345,sdsdfsd,36345,asdaa
3, 34123,34534,sdfsdf,3456345,sdsdfsd,36345,asdaa
4, dfg,34534,ghjhj,45645,sdsdfsd,36345,asdaa
5, 34123,34534,sdfsdf,3456345,sdsdfsd,36345,asdaa
6, xcv,34534,sdfsdf,3456345,sdsdfsd,36345,asdaa
7, 34123,xcv,sdfsdf,3456345,dfgdfgdfgdfg,36345,asdaa
8, 34123,34534,sdfsdf,456456,sdsdfsd,36345,asdaa
9, fgdf,34534,sdfsdf,3456345,sdsdfsd,36345,dfgdfg
10, 34123,34534,sdfsdf,vbnvb,vbnbnvb,36345,asdaa

后:

1, asdasd,34534,sdfsdf,456,sdsdfsd,36345,asdaa
10, 34123,34534,sdfsdf,vbnvb,vbnbnvb,36345,asdaa
3, 34123,34534,sdfsdf,3456345,sdsdfsd,36345,asdaa
4, dfg,34534,ghjhj,45645,sdsdfsd,36345,asdaa
5, 34123,34534,sdfsdf,3456345,sdsdfsd,36345,asdaa
9, fgdf,34534,sdfsdf,3456345,sdsdfsd,36345,dfgdfg
7, 34123,xcv,sdfsdf,3456345,dfgdfgdfgdfg,36345,asdaa
6, xcv,34534,sdfsdf,3456345,sdsdfsd,36345,asdaa
8, 34123,34534,sdfsdf,456456,sdsdfsd,36345,asdaa
2, ghjghj,34534,ert,3456345,sdsdfsd,36345,asdaa     

0 个答案:

没有答案