首页 > 代码库 > 小时代5-perl对文件按列排序
小时代5-perl对文件按列排序
perl中经常有会遇到处理CSV格式的文件,这样的文件类似二维数组,因此实际上的操作时对二维数组的操作了。
对这样的行列表格,我们常常需要按照某列,或者先按照某列,再按另一列进行排序,具体的操作可以看一下下面的实现:
- #!/usr/bin/perl
- my @line;
- while(<>)
- {
- chomp;
- push @line, [ split ];
- }
- foreach ( sort { $a->[0] <=> $b->[0] or $a->[1] <=> $b->[1] or $a->[2] <=> $b->[2] } @line)
- {
- print @$_, "n";
- }
注意:
对于大的文件,最好不要这么用。
该脚本会把数据全部搬到内存。
www.bbilo.com/gbdfzmzcwww.bbilo.com/gbdfbjlwww.bbilo.com/gbdfylyqwww.bbilo.com/mdgbdfrqrhwww.bbilo.com/gbdfmdyjmwww.bbilo.com/mdgbdfaqmwww.bbilo.com/gbdfkmdlwww.bbilo.com/gbdfxwzwww.bbilo.com/gbdfwtzxwww.bbilo.com/gbdfdmswww.bbilo.com/gbdfzcwww.bbilo.com/gbdfsywww.bbilo.com/gbdfwzxwww.bbilo.com/gbdfnyqbwww.bbilo.com/gbdfzjwww.bbilo.com/gbdfdzwww.jdcvv.com/gbdfylwwww.jdcvv.com/gbdfwww.jdcvv.com/gbdfkhwww.jdcvv.com/gbdfylwww.jdcvv.com/gbdfhykhwww.jdcvv.com/1659988_comgbdfwww.jdcvv.com/gbdfshywww.jdcvv.com/gbdfgwwww.jdcvv.com/gbdfwtwww.jdcvv.com/gbdfylcwww.jdcvv.com/gbdfdlwww.jdcvv.com/gbdfxcwww.jdcvv.com/gbdfyldlwww.jdcvv.com/gbdfylkhwww.jdcvv.com/gggbdfylcwww.jdcvv.com/gbdfsjzmdlwww.jdcvv.com/gbdfzmnyqwww.jdcvv.com/gbdfyjwww.jdcvv.com/gbdfxmfwww.jdcvv.com/szdmdgbdfwww.jdcvv.com/mdgbdfwww.jdcvv.com/gbdfdlkhwww.jdcvv.com/gbdfkh1581260www.jdcvv.com/gbdfylhbwzwww.jdcvv.com/gbdfyqwww.jdcvv.com/sygbdfylwww.jdcvv.com/gbdfylzmyqwww.jdcvv.com/gbdfylyflmwww.jdcvv.com/gbdfylcznlwww.jdcvv.com/gbdfwzwww.jdcvv.com/gbdftzwww.jdcvv.com/gbdfdhwww.jdcvv.com/gbdfsjwww.jdcvv.com/gggbdfwww.jdcvv.com/gbdfgfwwww.jdcvv.com/gbdfkhwwww.jdcvv.com/gbdfshwww.jdcvv.com/gbdfsjxzwww.jdcvv.com/gbdfylsjxzwww.jdcvv.com/gbdfwfmwww.jdcvv.com/gbdfdtkhwww.jdcvv.com/gbdfhywww.jdcvv.com/gbdfrhkhwww.jdcvv.com/gbdfzdlwww.jdcvv.com/gbdfwwww.jdcvv.com/gbdfdtkmdlwww.jdcvv.com/gbdfglwwww.jdcvv.com/gbdfxjwwww.jdcvv.com/gbdfwtkhzxwww.jdcvv.com/gbdfwtdhkhwww.jdcvv.com/gbdfwkhwww.jdcvv.com/gbdfwthykhwww.jdcvv.com/gbdftgywww.jdcvv.com/gbdfylwzwww.jdcvv.com/gbdfzmzcwww.jdcvv.com/gbdfbjlwww.jdcvv.com/gbdfylyqwww.jdcvv.com/mdgbdfrqrhwww.jdcvv.com/gbdfmdyjmwww.jdcvv.com/mdgbdfaqmwww.jdcvv.com/gbdfkmdlwww.jdcvv.com/gbdfxwzwww.jdcvv.com/gbdfwtzxwww.jdcvv.com/gbdfdmswww.jdcvv.com/gbdfzcwww.jdcvv.com/gbdfsywww.jdcvv.com/gbdfwzxwww.jdcvv.com/gbdfzjwww.jdcvv.com/gbdfdzwww.vqjqu.com/gbdfwww.vqjqu.com/gbdfkhwww.vqjqu.com/gbdfylwwww.vqjqu.com/gbdfylwww.vqjqu.com/gbdfhykhwww.vqjqu.com/1659988_comgbdfwww.vqjqu.com/gbdfdhtzwww.vqjqu.com/gbdfylptwww.vqjqu.com/gbdfshywww.vqjqu.com/gbdfzxkhwww.vqjqu.com/gbdfgwwww.vqjqu.com/gbdfwtwww.vqjqu.com/gbdfylcwww.vqjqu.com/gbdfdlwww.vqjqu.com/gbdfxcwww.vqjqu.com/gbdfyldlwww.vqjqu.com/gbdfkhblwww.vqjqu.com/gbdfylkhwww.vqjqu.com/gbylgbdfwww.vqjqu.com/gggbdfylcwww.vqjqu.com/gbdfsjzmdlwww.vqjqu.com/gbdfylflwww.vqjqu.com/gbdfzmnyqwww.vqjqu.com/gbdfyjwww.vqjqu.com/gbdfxmfwww.vqjqu.com/szdmdgbdfwww.vqjqu.com/mdgbdfwww.vqjqu.com/gbdfdhkhwww.vqjqu.com/gbdfdlkhwww.vqjqu.com/gbdfwtkhwww.vqjqu.com/gbdfkh1581260www.vqjqu.com/gbdfylhbwzwww.vqjqu.com/gbdfyqwww.vqjqu.com/sygbdfylwww.vqjqu.com/gbdfylzmyqwww.vqjqu.com/gbdfylyflmwww.vqjqu.com/gbdfylcznlwww.vqjqu.com/gbdfwzwww.vqjqu.com/gbdftzwww.vqjqu.com/gbdfdhwww.vqjqu.com/gbdfsjwww.vqjqu.com/gggbdfwww.vqjqu.com/gbdfgfwwww.vqjqu.com/gbdfkhwwww.vqjqu.com/gbdfshwww.vqjqu.com/gbdfylsjxzwww.vqjqu.com/gbdfwfmwww.vqjqu.com/gbdfhywww.vqjqu.com/gbdfzdlwww.vqjqu.com/gbdfwwww.vqjqu.com/gbdfdtkmdlwww.vqjqu.com/gbdfglwwww.vqjqu.com/gbdfxjwwww.vqjqu.com/gbdfwtkhzxwww.vqjqu.com/gbdfwtdhkhwww.vqjqu.com/gbdfwkhwww.vqjqu.com/gbdfwthykhwww.vqjqu.com/gbdftgywww.vqjqu.com/gbdfylwzwww.vqjqu.com/gbdfzmzcwww.vqjqu.com/gbdfbjlwww.vqjqu.com/gbdfylyqwww.vqjqu.com/mdgbdfrqrhwww.vqjqu.com/gbdfmdyjmwww.vqjqu.com/mdgbdfaqmwww.vqjqu.com/gbdfkmdlwww.vqjqu.com/gbdfxwzwww.vqjqu.com/gbdfwtzxwww.vqjqu.com/gbdfdmswww.vqjqu.com/gbdfzcwww.vqjqu.com/gbdfsywww.vqjqu.com/gbdfwzxwww.vqjqu.com/gbdfnyqbwww.vqjqu.com/gbdfzjwww.vqjqu.com/gbdfdzwww.ecbga.com/gbdfwww.ecbga.com/gbdfkhwww.ecbga.com/gbdfylwwww.ecbga.com/gbdfylwww.ecbga.com/gbdfhykhwww.ecbga.com/1659988_comgbdfwww.ecbga.com/gbdfdhtzwww.ecbga.com/gbdfylptwww.ecbga.com/gbdfshywww.ecbga.com/gbdfzxkhwww.ecbga.com/gbdfgwwww.ecbga.com/gbdfwtwww.ecbga.com/gbdfylcwww.ecbga.com/gbdfdlwww.ecbga.com/gbdfxcwww.ecbga.com/gbdfyldlwww.ecbga.com/gbdfkhblwww.ecbga.com/gbdfylkhwww.ecbga.com/gbylgbdfwww.ecbga.com/gggbdfylcwww.ecbga.com/gbdfsjzmdlwww.ecbga.com/gbdfylflwww.ecbga.com/gbdfzmnyqwww.ecbga.com/gbdfyjwww.ecbga.com/gbdfxmfwww.ecbga.com/szdmdgbdfwww.ecbga.com/mdgbdfwww.ecbga.com/gbdfdhkhwww.ecbga.com/gbdfdlkhwww.ecbga.com/gbdfwtkhwww.ecbga.com/gbdfkh1581260www.ecbga.com/gbdfylhbwzwww.ecbga.com/gbdfyqwww.ecbga.com/sygbdfylwww.ecbga.com/gbdfylzmyqwww.ecbga.com/gbdfylyflmwww.ecbga.com/gbdfylcznlwww.ecbga.com/gbdfwzwww.ecbga.com/gbdftzwww.ecbga.com/gbdfdhwww.ecbga.com/gbdfsjwww.ecbga.com/gggbdfwww.ecbga.com/gbdfgfwwww.ecbga.com/gbdfkhwwww.ecbga.com/gbdfshwww.ecbga.com/gbdfylsjxzwww.ecbga.com/gbdfwfmwww.ecbga.com/gbdfdtkhwww.ecbga.com/gbdfhywww.ecbga.com/gbdfrhkhwww.ecbga.com/gbdfzdlwww.ecbga.com/gbdfwwww.ecbga.com/gbdfdtkmdlwww.ecbga.com/gbdfglwwww.ecbga.com/gbdfxjwwww.ecbga.com/gbdfwtkhzxwww.ecbga.com/gbdfwtdhkhwww.ecbga.com/gbdfwkhwww.ecbga.com/gbdfwthykhwww.ecbga.com/gbdftgywww.ecbga.com/gbdfylwzwww.ecbga.com/gbdfzmzcwww.ecbga.com/gbdfbjlwww.ecbga.com/gbdfylyqwww.ecbga.com/mdgbdfrqrhwww.ecbga.com/gbdfmdyjmwww.ecbga.com/mdgbdfaqmwww.ecbga.com/gbdfkmdlwww.ecbga.com/gbdfxwzwww.ecbga.com/gbdfwtzxwww.ecbga.com/gbdfdmswww.ecbga.com/gbdfzcwww.ecbga.com/gbdfsywww.ecbga.com/gbdfwzxwww.ecbga.com/gbdfnyqbwww.ecbga.com/gbdfzjwww.ecbga.com/gbdfdzwww.urukw.com/gbdfwww.urukw.com/gbdfkhwww.urukw.com/gbdfylwwww.urukw.com/gbdfylwww.urukw.com/gbdfhykhwww.urukw.com/1659988_comgbdfwww.urukw.com/gbdfdhtzwww.urukw.com/gbdfylptwww.urukw.com/gbdfshywww.urukw.com/gbdfzxkhwww.urukw.com/gbdfgwwww.urukw.com/gbdfwtwww.urukw.com/gbdfylcwww.urukw.com/gbdfdlwww.urukw.com/gbdfxc
小时代5-perl对文件按列排序
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。