how to remove spaces in a string using sed.

Hello,

I have the following to remove spaces from beginning and end of a string.
infile=`echo "$infilename" | sed 's/^ *//;s/ *$//`

How do I modify the above code to remove spaces from beginning, end and in the middle of the string also.

              ex:  
                  Shell Programming is fun

Result should be:
ShellProgrammingisfun

ThankYou,
Radhika.

infile=`echo "$infilename" | sed 's/ //g'`

I have one more question- what is a good book for awk, sed, grep, kshell scripting for beginners like me.

ThankYou! for your prompt replies.

Appreciate it!
Radhika.

check out the FAQ and also this thread

A book that I've had success with is: UNIX Shells, by Ellie Quigley. It has some typos in it but it's rather good.