<分区>
我是初学者..我想用Linux shell来制作以下文件
1 2 2
2 3 4
4 5 2
4 2 1
....
进入
1,2,2
2,3,4
4,5,2
4,2,1
非常感谢!
<分区>
我是初学者..我想用Linux shell来制作以下文件
1 2 2
2 3 4
4 5 2
4 2 1
....
进入
1,2,2
2,3,4
4,5,2
4,2,1
非常感谢!
最佳答案
你在找这样的东西吗:-
sed -e "s/ /,/g" < a.txt
或者像这样更容易:
tr ' ' ',' <input >output
或者在 Vim 中你可以使用正则表达式:
s/ /,/g
关于linux - 如何使用Linux逐行读取文件并将所有空格替换为 ','?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19186322/