On 2006.05.26 22:34 Sam Lawrance wrote:
The argument for "-i" is optional; if supplied sed provides a backup; if not supplied sed amends the input file. See "man sed"

That is ridiculous. Unless you know in advance what the argument will be, it is not possible to detect that it has not been supplied.

Look, I don't know whether it is ridiculous or not. I use "sed -i" simpliciter often from the command line to wipe all text from a file:
sed -i 'd' input.file

It works for me; YMMV. I do, however, suggest you RTFM. The man page is quite clear


Anyhow, my main point is that any form of '-i' is a nonstandard extension.

In the context of the request I did not think that portability was an issue. If it were, then clearly something more than my Q&D command one-liner might be desirable.

Robert Thorsby
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to