I tried to replace all the dot as missing value. I tried used sed 's/^./Missing/g' test.txt. There is no change. When used sed 's/.$/Missing/g' test.txt. Only the dot in the last column changed.
ex. col1 col2 col3 . 13.34 12.44 12.3 . 12.22 . 125.5 .
3 answers
Assuming your data is space separated:
sed 's/ . / Missing /g' test.txt
It's not working. I just tried 'sed 's/./Missing/g' colon.txt', it replaced all the dot, even the dot in '12.44'
Note the spaces before and after the dot and before and after the Missing
to be really space/tab independent, the proper way to write it would be
sed 's/\(\s\)\.\(\s\)/\1Missing\2/g' test.txt
unfortunately this won't work with 2 consecutive dot columns, neither with the first and last columns. see my answer below.
a sed independent solution on field separators, that would deal with 2 consecutive dot columns plus the first and last columns would be the following
sed 's/\./Missing/g; s/Missing\(\S\)/.\1/g' test.txt
or its perl alternative
perl -pe 's/\./Missing/g; s/Missing(\S)/.$1/g' test.txt
Log in to answer this question.