Search files and replace string in all files


#1

Hi,

I need to find all in directory /var/www/ recursively with extension .txt and replace string in each file. The files contain string: admin and I need to change it to administrator.

thanks


#2

Hi,

I need to find all in directory /var/www/ recursively with extension .txt and replace string in each file. The files contain string: admin and I need to change it to administrator.

thanks

Hi,

Please use following bash command

find /var/www/ -type f -iname “*.txt” -print0 | xargs -0 sed -i ‘s/admin1/administrator/g’

Thanks

bnhashmi


#3

worked…I only had to change admin1 to admin

thank you…


#4