Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Jan 2005 17:44:46 +0100
From:      "Norbert Koch" <NKoch@demig.de>
To:        <freebsd-questions@freebsd.org>
Subject:   AW: One-line global string replace in all files with sed (or awk?)
Message-ID:  <000a01c503c6$57c58ea0$4801a8c0@ws-ew-3.W2KDEMIG>
In-Reply-To: <1878149195.20050126164325@wanadoo.fr>

next in thread | previous in thread | raw e-mail | index | archive | help
Well, shell lines may be quite long ;-)

Do you mean something like this

sed -Ee 's/search/replace/g' -i .BAK `find . -name '*.c' -type f`


> A few years ago, I'm sure I came across a one-line way of replacing
> every occurence of one string with another in an entire directory of
> files (potentially including all subdirectories as well).  I think it
> used sed or awk.  Now I can't find it.  The examples on the Web are all
> multiline scripts or programs, but I'm sure I saw a way to do it all on
> just one line.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?000a01c503c6$57c58ea0$4801a8c0>