replace 2 spaces by one

Dear Friends,
I have a flat file from which I want to remove single "space". And, wherever two spaces are provided it should replace it by only one space.

E.g.
I have
N A T I O N A L E D U C A T I O N F O R O R G AN I S A T I ON S
I want
NATIONAL EDUCATION FOR ORGANISATIONS

Please guide me.
Thank you in advance.

awk '{$0=gensub("([^ ]) ([^ ])","\\1\\2","g");$0=gensub("([^ ]) ([^ ])","\\1\\2","g");$0=gensub("([^ ])  ([^ ])","\\1 \\2","g");print}' file

try with this...

sed   's/\([^ ]\)[ ]\([^ ]\)/\1\2/g' IN_FILE| sed 's/  / /g'

Sorry, this not works because 'jump' the characteres substitued... but this is a 'ugly' way:

sed   's/\([^ ]\)[ ]\([^ ]\)/\1\2/g' fichero0 | sed  's/\([^ ]\)[ ]\([^ ]\)/\1\2/g' | sed 's/  / /g'

I woul like to know how "reexecute" the sed from the first character...so I will have the danger of an infinite loop!

one way:

$ echo 'N A T I O N A L  E D U C A T I O N  F O R  O R G AN I S A T I ON S' | awk '{gsub(/[ ]{2}/,"\t");gsub(/[ ]/,"");gsub("\t"," ");print}'
NATIONAL EDUCATION FOR ORGANISATIONS
$ 

Hi

echo "----your string---" | sed 's/\([^ ]\)\( \)/\1/g'

Guru.

sed 's/\([^ ]\) /\1/g'

GNU sed:

sed 's/\b //g'