非常感谢,您的回复给予我很大的帮助!

2013/5/15 cheung mc <[email protected]>

>
>
>
>
>
>
>
> On 2013-5-15, at PM6:46, "Roger chen" <[email protected]> wrote:
>
> > 写一个每行3个的,你可以调一下看看。
> > while (<>){
> > chomp ;
> > push @a,$_;
> > }
> > $a=($#a+1)/3;
> > for $x (0..$a){
> > for $y (0..2){
> > print "$a[$x*3+$y]\t";
> > }
> > print "\n";
> > }
> >
> >
> >
> > 0.924   0.609   0.742
> > 0.808   0.832   0.866
> > 0.61    0.584   0.854
> > 0.91    0.863   0.706
> > 0.925   0.719   0.828
> > 0.701   0.761   0.795
> > 0.717   0.7     0.968
> > 0.604   0.751   0.825
> > 0.844   0.863   0.621
> > 0.568   0.876   0.917
> >
> > -----邮件原件-----
> > 发件人: [email protected] [mailto:[email protected]] 代表
> > Li Xiangchen
> > 发送时间: 2013年5月15日 17:39
> > 收件人: [email protected]
> > 主题: [PerlChina] 用perl对文本的列进行处理的问题
> >
> > 我有一个文本,里面数据是这样:
> > 0.924
> > 0.609
> > 0.742
> > 0.808
> > 0.832
> > 0.866
> > 0.61
> > 0.584
> > 0.854
> > 0.91
> > 0.863
> > 0.706
> > 0.925
> > 0.719
> > 0.828
> > 0.701
> > 0.761
> > 0.795
> > 0.717
> > 0.7
> > 0.968
> > 0.604
> > 0.751
> > 0.825
> > 0.844
> > 0.863
> > 0.621
> > 0.568
> > 0.876
> > 0.917
> > ...
> > 我想没隔20行,提取一组数据,然后把文本变成如下形式的:
> > 0.924 0.968   0.712   0.911   0.939
> > 0.609 0.604   0.685   0.873   0.912
> > 0.742 0.751   0.633   0.561   0.581
> > 0.808 0.825   0.678   0.807   0.744
> > 0.832 0.844   0.654   0.763   0.831
> > 0.866 0.863   0.676   0.842   0.847
> > 0.61  0.621   0.569   0.597   0.609
> > 0.584 0.568   0.508   0.577   0.538
> > 0.854 0.876   0.685   0.769   0.84
> > 0.91  0.917   0.725   0.862   0.908
> > 0.863 0.868   0.663   0.803   0.867
> > 0.706 0.709   0.589   0.647   0.695
> > 0.925 0.923   0.737   0.863   0.91
> > 0.719 0.712   0.639   0.72    0.688
> > 0.828 0.835   0.644   0.775   0.835
> > 0.701 0.713   0.594   0.609   0.695
> > 0.761 0.776   0.644   0.739   0.767
> > 0.795 0.807   0.65    0.733   0.822
> > 0.717 0.747   0.579   0.641   0.676
> > 0.7   0.721   0.586   0.646   0.662
> > 这样的每20行数据为一列,中间以制表符隔开的形式,但苦于刚学Perl不太会写程序操
> > 作,还请朋友帮忙,谢谢!
> > --
> > 使用Opera的电子邮件客户端:http://www.opera.com/mail/
> >
> > --
> > 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论
> > 坛。
> > 要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到
> > [email protected]。
> > 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
> > 通过以下网址访问此论坛:http://groups.google.com/group/perlchina?hl=zh-CN。
> > 要查看更多选项,请访问 https://groups.google.com/groups/opt_out。
> >
> >
> > --
> > 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
> > 要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到 [email protected]。
> > 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
> > 通过以下网址访问此论坛:http://groups.google.com/group/perlchina?hl=zh-CN。
> > 要查看更多选项,请访问 https://groups.google.com/groups/opt_out。
> >
> >
>
>
> --
> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
> 要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到 [email protected]。
> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
> 通过以下网址访问此论坛:http://groups.google.com/group/perlchina?hl=zh-CN。
> 要查看更多选项,请访问 https://groups.google.com/groups/opt_out。
>
>
>
>

-- 
您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到 [email protected]。
要向此网上论坛发帖,请发送电子邮件至 [email protected]。
通过以下网址访问此论坛:http://groups.google.com/group/perlchina?hl=zh-CN。
要查看更多选项,请访问 https://groups.google.com/groups/opt_out。


回复