Replace string in all files in a directory - Redhat
This is a discussion on Replace string in all files in a directory - Redhat ; Is there a utility or command that will allow me to replace all occurrences
of a string within all files in a directory?
I'm trying to mass update IP addresses of all DNS zone files in my
/var/named/ folder....
-
Replace string in all files in a directory
Is there a utility or command that will allow me to replace all occurrences
of a string within all files in a directory?
I'm trying to mass update IP addresses of all DNS zone files in my
/var/named/ folder.
-
Re: Replace string in all files in a directory
"Shabam" wrote in
news:MImdnaituqywHQfcRVn-ig@adelphia.com:
> Is there a utility or command that will allow me to replace all
> occurrences of a string within all files in a directory?
>
> I'm trying to mass update IP addresses of all DNS zone files in my
> /var/named/ folder.
>
>
>
find . -exec sed .....
-
Re: Replace string in all files in a directory
In article , Shabam wrote:
> Is there a utility or command that will allow me to replace all occurrences
> of a string within all files in a directory?
>
> I'm trying to mass update IP addresses of all DNS zone files in my
> /var/named/ folder.
Assuming old IP is '192.168.0.5' and new IP is '10.1.0.6', you can do this:
# perl -pi -e 's/192\.168\.0\.5/10.1.0.6/g' /var/named/*
You can also do this, which will make a backup of each file with a ".bak"
extension:
# perl -pi.bak -e 's/192\.168\.0\.5/10.1.0.6/g' /var/named/*
Kevin