[RndTbl] Little script puzzle help.
sean at tinfoilhat.ca
Tue Jul 31 11:52:45 CDT 2012
On 2012-07-31 10:59, Adam Thompson wrote:
> Err... that does involve the use of temporary files, it's just hidden
> you. I'm not aware of any way around that unless the replacement
> happen to be exactly the same length (in bytes) as the original text,
> which case you need to use dd(1) with skip= and/or seek= to avoid
> a temporary file. Even sed(1) and/or perl(1) with "-i" will create a
> temporary file behind the scenes, since there's no magic syscall (nor
> physical way) to _slide_ the bits forwards or backwards on the disk!
A better way to state my case is 'no temporary files _I_ have to
explicitly manage.' I think I'll try a trace on ex and see if it uses a
temporary file. I don't see why it wouldn't (as reading in the entire
file into a buffer and dumping back to the original file seems kind of
dangerous). Academically interesting. I definitely trust the
implementation of sed/ed/ex/vi over my scripting abilities to properly
manage the temp files. :)
> If you're going for ultimate portability, I recommend you fall back
> ed(1), since that can be used either as-is with ed(1) or with
> The command-line invocation will be slightly uglier than than with
The ex trick worked _very_ well.
Deployment went smoothly on all 30 odd hosts.
More information about the Roundtable