On 1 Jun, Jonathan Wilson wrote:
So my question is, is there a way to /edit/ a file with sed (or awk) directly, without first redirecting it to a tmp file and then catting the tmp file back into the original?
The shell programs will always need a temporary file. The reason comes from how the shell handles re-direction. You can either overwrite a file (>), or append to it (>>). But you can't replace it starting at certain byte position. The overwrite erases the file first, then starts writing out new data. The shell erases the file before 'sed' ever starts. So you end up with zero bytes of data. I have a shell script that handles the creation of the tmp file, and copying it back over the original. I'd be happy to share it. Just e-mail me off the list. -- Robert Wohlfarth rjwohlfar@bigfoot.com "Is not life more important than food, and the body more important than clothes?" -- Matthew 6:25b