太牛了,一个比一个短
2013/8/20 54chen <[email protected]> > NB啊,一个更比一个短,哈哈。 > xargs -d'\n' -n2 > perl -ne '$.%2==0 ? print : chomp && print' file.txt > awk 'NR%2{printf $0"\t"}(NR-1)%2{print $0}' urfile > > > 在 2013年8月20日下午3:02,夏凯 <[email protected]>写道: > > On 2013年08月20日 14:59, 李相辰 wrote: >> >>> 完全对awk不懂,能在perl上给点提示吗? >>> >> awk版本awk 'NR%2{printf $0"\t"}(NR-1)%2{print $0}' urfile >> 说下原理吧,其实很简单,判断当前行是奇数行还是偶数行,**奇数行,打 印$0+\t,注意,不要\n;偶数行打印$0+\n。 >> >> >> -- >> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。 >> 要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到 >> perlchina+unsubscribe@**googlegroups.com<perlchina%[email protected]> >> 。 >> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。 >> 通过以下网址访问此论坛:http://groups.**google.com/group/perlchina<http://groups.google.com/group/perlchina> >> 。 >> 要查看更多选项,请访问 >> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >> 。 >> > > > > -- > - > http://www.54chen.com 坚持科学 分享技术 > http://twitter.com/54chen > > -- > 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。 > 要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到 [email protected]。 > 要向此网上论坛发帖,请发送电子邮件至 [email protected]。 > 通过以下网址访问此论坛:http://groups.google.com/group/perlchina。 > 要查看更多选项,请访问 https://groups.google.com/groups/opt_out。 > -- From William LI -- 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。 要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到 [email protected]。 要向此网上论坛发帖,请发送电子邮件至 [email protected]。 通过以下网址访问此论坛:http://groups.google.com/group/perlchina。 要查看更多选项,请访问 https://groups.google.com/groups/opt_out。
