2016-11-04 101 views
0

我有一些文本文件,如下所示。我想在全部逗號後添加空格字符。我怎樣才能在Linux?如何在特定字符linux後添加行空格

J12_1xtc, 10, 10, 1,-10.0600, 43.7866, -1.4100, 51,19 
CP0_1xtc, 10, 9, 1,-11.3600, 44.3436, -0.8000, 44, 6 
TS2_1xtc, 10, 10, 1,-11.1200, 44.3918, -3.0000, 61,14 
BNR_1xtc, 10, 10, 1,-11.1500, 44.4234, -3.9000, 96,22 
VAX_1xtc, 10, 10, 1,-10.9400, 44.7986, -3.8300, 137,27 
ABC_1xtc, 10, 10, 1,-13.2500, 45.0794, -2.3300, 82,30 
KAN_1xtc, 10, 10, 1,-14.7400, 46.2663, -0.3800, 48,17 
6M0_1xtc, 10, 10, 1,-16.0100, 46.5524,-11.5400, 48,16 
X2A_1xtc, 10, 10, 1,-14.6100, 46.7213, -1.2500, 72,15 
1P2_1xtc, 10, 4, 5,-11.8300, 46.7528, -0.7300, 100, 2 
6VQ_1xtc, 10, 10, 1,-10.2200, 46.8703, -0.5800, 71,24 
1P1_1xtc, 10, 5, 2,-12.0200, 46.9872, -0.0700, 100, 2 
HI1_1xtc, 10, 10, 1,-10.1800, 47.6840, -2.5100, 52,17 
I21_1xtc, 10, 10, 1,-10.7500, 48.6488, -0.7200, 42, 3 
2KC_1xtc, 10, 10, 1,-10.1000, 48.9203, -0.3100, 31, 6 
51H_1xtc, 10, 10, 1,-14.7900, 48.9305, -0.1500, 73,25 
+4

讓我們瞭解您到目前爲止試過嗎? – sat

回答

1

添加空間:

sed -i 's/,/, /g' fname.txt 
+0

非常感謝,如果我想在第四個逗號後添加一個空格字符,我該怎麼做? – sulejmani

+2

@Sulejmani,使用's /,/,/ 4'來代替第四次出現的模式......用GNU sed,你可以用'/,/,/ 4g'來代替從第四次比賽開始的所有事件 – Sundeep

相關問題