You can't. Either use ed or GNU sed or perl, or do what they do behind the scenes, which is to create a new file for the contents.

`ed`, portable:

    ed foo <<EOF
    1,$s/^\([^,]*\),\([^,]*\),\([^,]*\).*/\1,\3/
    w
    q
    EOF

GNU `sed`:

    sed -i -e 's/^\([^,]*\),\([^,]*\),\([^,]*\).*/\1,\3/' foo

Perl:

    perl -i -l -F, -pae 'print @F[1,3]' foo

`cut`, creating a new file (recommended, because if your script is interrupted, you can just run it again):

    mv foo foo.old
    cut -d , -f 1,3 <foo.old >foo &&
    rm foo.old

`cut`, replacing the file in place (retains the ownership and permissions of `foo`, but needs protection against interruptions):

    cp foo foo.old &&
    cut -d , -f 1,3 <foo.old >foo &&
    rm foo.old

I recommend using one of the `cut`-based methods. That way you don't depend on any non-standard tool, you can use the best tool for the job, and you control the behavior on interrupt.