> The trouble with this is that the same string can appear more than > once (before, after the field, ...), so the simple substitution isn't > enough.
It's sounding like awk is the wrong tool. It should be trivial to code up a short piece of C to do the job.