Help on search and replace in a file

Hi all,

The operating system is Solaris 10

I have example line here below I need to change the stat1 to stat2 using a shell script. search for space(" ") and replace with "\ "

Stat1 --- /data/Sat Night Stay.txt

Stat2 --- /data/Sat\ Night\ Stay.txt

Thanks
Firestar.

Hi,
This might help you...

jaise$ stat1=/data/Sat\ Night\ Stay.txt
jaise$ echo $stat1   
/data/Sat Night Stay.txt           
jaise$ echo $stat1 | sed 's: :\\:g'                             /* For better readability I used ':'  as the delimiter
/data/Sat\Night\Stay.txt