AW: One-line global string replace in all files with sed (or awk?)

Norbert Koch NKoch at
Wed Jan 26 08:46:16 PST 2005

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.

More information about the freebsd-questions mailing list