How do I find and replace every occurrence of:
subdomainA.example.com
with
subdomainB.example.com
in every text file under the /home/www/
directory tree recursively?
How do I find and replace every occurrence of:
subdomainA.example.com
with
subdomainB.example.com
in every text file under the /home/www/
directory tree recursively?
I just use tops:
Here's a version that should be more general than most; it doesn't require
find
(usingdu
instead), for instance. It does requirexargs
, which are only found in some versions of Plan 9 (like 9front).If you want to add filters like file extensions use
grep
:For me the easiest solution to remember is https://stackoverflow.com/a/2113224/565525, i.e.:
NOTE:
-i ''
solves OSX problemsed: 1: "...": invalid command code .
NOTE: If there are too many files to process you'll get
Argument list too long
. The workaround - usefind -exec
orxargs
solution described above.Try this:
Using combination of
grep
andsed