Sulejmani Sulejmani - 1 month ago 6
Linux Question

how to add a space in lines after specific character linux

I have some text files as below. I would like to add a space character in all lines after all comma character. How can I do in 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

Answer

To add space:

sed -i 's/,/, /g' fname.txt
Comments