I have this following data set in one file (.txt file)
data1 = 275736 490;data11 = 87551 1004; data2 = 344670 4875; data3 = 472996 840;data4 = 0 0;data = 19708 279;data6 = 10262 18;data7 = 0 0;data8 = 428 6;data9 = 5986 11;data10 = 15114 173;data11 = 7483 106;data = 15900 25;
I want replace this digit space digit pattern (for example 472996 840) to digit,digit pattern (472996,840). This has to be done for 0 0 also as 0,0. values shouldn't be changed. I cannot replace all white space since other whitespace are needed as well. I have to replace white space between the digits to another string.
Any suggestions using tr/sed/awk ?
Tried this :
sed -i 's/\d+\s\d+/\d+\d+/g' comment3.txt
Also, in tr looks like we cannot match a pattern
sed -E 's/([0-9])[ ]([0-9])/\1,\2/g' file
then add-i
when satisfied it does what you intend. – Kruegertr
is wholly unsuitable for this. I (finally) updated thetr
tag info page with a note about this. – Shephard