replace space or spaces in a line of a file with a single :

I am searching while I await a response to this so if it has been asked already I apologize.

I have a file with lines in it that look like:
bob johnson email@email.org

I need it to look like:
bob:johnson:email@email.org

I am trying to use sed like this:

sed -e 's/ /:/g' file > newfile

but it is giving me:

bob:johnson email@email.org

ie just doing it the first time in each line not through the entire line. Can someone tell me how to do it through the entire line?

try this:

sed -e 's/\s/:/g' test.log

This works just fine.
Make sure your 'spaces' are not 'tabs'.

echo 'bob johnson   email@email.org' | sed 's/  */:/g'

This is not a 'standard' sed - most likely GNU sed.

sed -e 's/\s/:/g' test.log

did it! Thank you so much!

You are correct.