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 楼
相关阅读
[合集] 为什么中国没有山寨twitter/ident.ca呢?The command line is powerful, but the UI can be more efficient!DELL D610 Docking questionperl design patternslenova U1[版务]12月份优秀版主名单提名及伪币奖励请问可以在Mac台式机上装ubuntu吗有谁实现过NFS V3 OVER SSH TUNNEL? 高手说说Ruby and ROR.VNC闪一下就退出了大家比较一下thinkpad x200和hp tm2t?click sound of ubuntu问问dual os 的问题有matplotlib或numpy/scipy的同学帮我试试 (转载)Google Doc用什么中文输入 ?gij?sourceforge改版的真差怎么让 thunar 用 GB2312 编码呢?真烦人阿TightVNC要用 iconv 需要转什么package啊