How to replace space using sed in shell script
Hi All,
I want to use sed to replace multiple spaces with single character(say : ).
ex: test.txt
12:Mit 23627 83763 tty message
suppose the file test.txt contains the line as above and i want to replace all spaces with : so that the outcome should be like below:
12:Mit:23627:83763:tty:message
i have used
sed 's/ /:/g' test.txt
but this command replacing every single space with a :, so the output is like:
12:Mit:::23627:83763::::tty:::::::message
|