Sed,nawk for inputfile and out put file same

Hi,

I am using sed and nawk command for replace/add/remove on file records.

But when I am using the inputfile name and directing output to the same inpu name file becomes empty.
I don't want to use to copy it to another file and move it back to original file.

Example:

sed 's/./,&/17' inputfile > inputfile--------->becomes inputfile empty

I want it to be work in a sigle comamnd can it be possible, please let me know.

You don't have any choice if your sed version doesn't support the -i option.

Regards

here's the poor-man's version of 'sed -i':

{ rm FILE; sed -e '...' > FILE; } < FILE