Posted on Wednesday, March 19, 2008 12:50 PM
This week I had to replace multiple occurences of a text on a windows PC. The text could be found in multiple html or php files scattered over multiple directories and subdirectories.
Here's how I did it:
- I started up my linux box
- created a working directory (mkdir smbshare)
- smbmount //machinename/sharename smbshare -ousername=administrator
- type in the password
- find smbshare -type f \(-name “*.html“ -o -name “*.htm“ -o name “*.php“ \) | xargs grep -li “mytext“ | xargs sed -i -e 's/mytext/mynewtext/gi'