Linux中将一列变成两列

丁丁 发表于 2013-1-16 16:17:33

如何用shell 实现将一列分为两列 ???

1
2
3
4
5
6
7
8
变成下面这样
1      2
3      4
5      6
7      8
用shell 能实现吗??? 不仅限于shell 其他命令也行??

dn833 发表于 2013-1-16 16:41:04

seq 10|awk 'ORS=NR%2?"\t":"\n"'

 

hn_lwdian 发表于 2013-1-16 16:53:21

xargs -n2 <filename

 

hn_lwdian 发表于 2013-1-16 16:53 static/image/common/back.gif
xargs -n2

试了 可以  非常感谢:handshake 
xargs -n2 <ab
1 2
3 4
5 6
7 8

 

bikong0411 发表于 2013-1-16 18:37:17

seq 1 8 | sed 'N;s/\n/\t/'

 

 

by917611 发表于 2013-1-17 15:56:09

sed 'N;s/\n/ /g'

 

LCY 发表于 2013-2-22 14:05:45

怎样把2列变成1列呢

guodong75 发表于 2013-2-22 16:38:03

LCY 发表于 2013-2-22 14:05 static/image/common/back.gif
怎样把2列变成1列呢

cat file
1 2
3 4


sed 's/ /\n/'
1
2
3
4

 

guodong75 发表于 2013-2-22 16:39:47

怎么能没有paste呢。
seq 6|paste - -
1    2
3    4
5    6

 

dn833 发表于 2013-2-22 17:28:52

LCY 发表于 2013-2-22 14:05 static/image/common/back.gif
怎样把2列变成1列呢

awk 'BEGIN{RS=" "}1'

 

akin520 发表于 2013-2-22 17:45:46

seq 10|xargs -n 2
用xargs方便

 
posted @ 2017-04-19 20:35  何帅  阅读(2437)  评论(1)    收藏  举报