Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Dec 2002 14:39:39 +0100
From:      Roman Neuhauser <neuhauser@bellavista.cz>
To:        questions@FreeBSD.ORG
Subject:   Re: is there a "replace command" ?
Message-ID:  <20021202133939.GR35908@freepuppy.bellavista.cz>
In-Reply-To: <20021202140543.G19865-100000@slave.east.ath.cx>
References:  <XFMail.20021202064129.conrads@cox.net> <20021202140543.G19865-100000@slave.east.ath.cx>

next in thread | previous in thread | raw e-mail | index | archive | help
# andrew@kronos.HomeUnix.com / 2002-12-02 14:20:44 +0100:
> Today Conrad Sabatier wrote:
> > Recent versions of FreeBSD now have a version of 'sed' that can do these
> > types of replacements "in place", i.e., without the need for a temporary
> > file:
> 
> > sed -i -e 's/^touch /rm /' infile
> 
> No. I'm pretty sure, there is a temporary file somewhere. You can't
> edit a file `in place' really, w/o a need temporary files (or ev.
> memory mapping the file). With the `-i' flag sed does this for you,
> ie. no need that you create a temporary file.

    wow, even the man page is not this anal. :)

    point in case: there's no tmp file from the user's perspective, and
    Conrad Sabatier's description is in line with the man page text:

    -i extension
        Edit files in-place, saving backups with the specified extension.
        If a zero-length extension is given, no backup will be saved.  It
        is not recommended to give a zero-length extension when in-place
        editing files, as you risk corruption or partial content in situ­
        ations where disk space is exhausted, etc.

-- 
If you cc me or remove the list(s) completely I'll most likely ignore
your message.    see http://www.eyrie.org./~eagle/faqs/questions.html

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021202133939.GR35908>