Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Dec 2001 12:24:18 +0100
From:      "Anthony Atkielski" <anthony@freebie.atkielski.com>
To:        "Magnus B{ckstr|m" <b@etek.chalmers.se>
Cc:        "FreeBSD Questions" <freebsd-questions@FreeBSD.ORG>
Subject:   Re: Command to make modifications on multiple files
Message-ID:  <009301c187b6$88994bf0$0a00000a@atkielski.com>
References:  <Pine.OSF.4.21.0112181148540.25097-100000@downy.etek.chalmers.se>

next in thread | previous in thread | raw e-mail | index | archive | help
Hmm ... I was kind of hoping for a single command that would do it for me,
so I wouldn't have to debug something I'd write myself.  However, I'll
consider this, if I can't find anything ready-made.  I'd prefer not to write
a script of my own and discover a bug in it the hard way, which would mean a
lot of restoring.

----- Original Message -----
From: "Magnus B{ckstr|m" <b@etek.chalmers.se>
To: "Anthony Atkielski" <anthony@freebie.atkielski.com>
Cc: "FreeBSD Questions" <freebsd-questions@FreeBSD.ORG>
Sent: Tuesday, December 18, 2001 11:50
Subject: Re: Command to make modifications on multiple files


> On Tue, 18 Dec 2001, Anthony Atkielski wrote:
> > There is probably a UNIX command that allows me to replace strings in
> > multiple files all at once, but I can't remember what the name of it
would
> > be, and this being UNIX, I'm sure the name is not the least bit
intuitive.
> > Any suggestions on what command would do this?  Sort of like grep, but
with
> > an option to replace a string as well as just finding it.
> >
>
> Using bourne shell, something like
>
> for f in whatever/files/*.txt ; do
>     sed -e 's/string to be replaced/new string/g' < ${f} > ${f}.tmp
>     mv ${f}.tmp ${f}
> done
>
> // Magnus
>
>
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message
>


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?009301c187b6$88994bf0$0a00000a>