SED Issue please advise!!!

Hi folks,

Please share your ideas I want to conventor all the blank space's in my file to a single blank,

Im using this currently sed 's/ / /' foo for two blank space but the blanks in the file varies like for example 2 blanks, 3 blanks, 4 blanks etc etc....

please help what should I use here to convert into single blank in a file..

Quick response will be appreciated!!!

Haque

Assuming blank space also includes tabs then the following should work for you

sed 's/[[:blank:]][[:blank:]]*/ /g' file

With awk:

awk '{$1=$1}1' file