linux系统中将矩形数据转换为一行、一列的形式
1、测试数据
[root@centos79 test]# cat a.txt
e t c i w
s g g d z
c i o n m
2、转换为一行
[root@centos79 test]# cat a.txt e t c i w s g g d z c i o n m [root@centos79 test]# awk '{ORS = " "}{print $0} END {printf "\n"}' a.txt e t c i w s g g d z c i o n m
3、转换为一列
[root@centos79 test]# cat a.txt e t c i w s g g d z c i o n m [root@centos79 test]# tr " " "\n" < a.txt e t c i w s g g d z c i o n m

浙公网安备 33010602011771号