bash 如何在 Linux 中将一列分成多列
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30750082/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 13:09:54 来源:igfitidea点击:
how to break one column into multiple columns in Linux
提问by Kay
I want to break a column into different rows. e.g.,
我想将一列分成不同的行。例如,
test.dat
1
4
3
4
6
2
4
6
8
What I want is to break it into a 3 x 3 matrix
我想要的是把它分解成一个 3 x 3 的矩阵
out.dat
1 4 4
4 6 6
3 2 8
回答by Rakholiya Jenish
Try using:
尝试使用:
pr -ts" " --columns 3 file_name
It is good and short if you don't want to use awk
.
如果您不想使用awk
.
There are other methods too (one I told you, I also learnt it from there):
还有其他方法(我告诉过你的,我也是从那里学到的):