Discussion Locked

Recursively find and replace a string

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I want to find a regexp say "abc" in alll file sin the directory "dir" and all its subdirectory and replace them with "xyz"

5 replies

by ebob

The regexp should be:

s/abc/xyz/g

But you'll have to work a loop out goes through each file in "dir" (except "." and ".." - and what about files of type "d", i.e., subdirectories?).

by manojit

I really do not want to write a full shell script I want a one line solution someting like
find . -print |xargs grep "abc" | sed...

This discussion is closed to new replies.