need help in sed command

Hello.

I have one big data file and i have to replace two words in first line.
right now i have following command that working fine.

sed -e '1 s/'$E_STR_NUM'/'$STR_NUM'/g' -e '1 s/'$F_NUM'/'$R_NUM'/g' $FILE_NAME > $TMP_NAME

But i don't want to redirect the output in another file i want to replace in same file so i don't have remove that temp file.

Any help is appreciated.

GNU sed has the -i option - if you're on a box with GNU tools, usually Linux.

No, I'm working on sun solaris....it's illegal option in sun solaris

You could use Perl, which offers the -i option in all versions since way back. Its syntax is basically identical to sed syntax as far as the s/// substitution operator is concerned. There's a s2p script for converting nontrivial sed scripts, but for this one, just use if (1..1) instead of the plain 1.

perl -pi~ -e 'if (1..1) { s/'$E_STR_NUM'/'$STR_NUM'/g; s/'$F_NUM'/'$R_NUM'/g; }' $FILE_NAME

Thanks era!!!!!!
It works fine!!!
I appreciate for your help