I want to replaces all multiple spaces with one space. My first attempt was this:
sed -e 's/\ */\ /g' This replaced all multiple spaces with one but as a side effect, sed inserted a space between all characters. Playing a little I tried this: sed -e 's/[\ ]\ */\ /g' and this works. The fact is that I don't understand why the first one doesn't work. Can someone explain me that?