i*9
2 楼
i have a simple file content like this:
tom
john
dennis
karl
derek
anne
....
how to print it use awk. 4 columns only, rows doesn't matter
[1] tom [2] john [3] dennis [4] karl
[5] derek [6] anne
the file might grow ...
tom
john
dennis
karl
derek
anne
....
how to print it use awk. 4 columns only, rows doesn't matter
[1] tom [2] john [3] dennis [4] karl
[5] derek [6] anne
the file might grow ...
x*m
4 楼
这样中不中?
$ awk '{ printf "[" NR "]" $1 " "; if(NR%4==0) print "\n" } input.txt
$ awk '{ printf "[" NR "]" $1 " "; if(NR%4==0) print "\n" } input.txt
j*6
5 楼
Try Jean Chen
x*m
6 楼
我那浆糊般脑袋的最爱,最后一节有点问题。谁给修修?
$ sed "=" input.txt | sed "s/^[0-9]*$/[&]/g" | sed ':a;N;$!ba;s/]\n/] /g' |
tr -s '\n' ' ' | sed "s/\(\[[0-9]*\] [a-z]*\s\)\{4\}/\n/g"
$ sed "=" input.txt | sed "s/^[0-9]*$/[&]/g" | sed ':a;N;$!ba;s/]\n/] /g' |
tr -s '\n' ' ' | sed "s/\(\[[0-9]*\] [a-z]*\s\)\{4\}/\n/g"
D*n
7 楼
相关阅读
全球码农向CCTV春晚宣战?有人折腾过bcache吗?how to install chinese support in redhat?Technical Lead Openings in Major Networking Company (south SF bay area)dns-nameservers field in /etc/network/interfaceubuntu server 11.10 在uefi的系统上boot不了unix network programming (Stevens) book V1 (2ed, 3ed) code cannot run on Linuxsimulate connection drop by iptables?How to setup 2 NICs for 2 different network using DHCP ?大家能帮我看一下下面的问题吗,不胜感激。有没有非智能手机的deal呀? (转载)How to register linux network driver ?Linux 新手求教:在Cygwin下运行linux程序,主要有哪些限制? (转载)越用越觉得c好用为什么 hack的xbox 会被ban? (转载)Linux 的 License 疑惑PPStream in Ubuntu 11.10 stops working建设精华区 请各位大神菜鸟积极贡献 大包子伺候Amex Gold Premier信用卡送1000刀 Match 75K Bonus谁推荐一个灭有风扇的Desktop (转载)