Wednesday, March 19, 2008

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:

  1. I started up my linux box
  2. created a working directory (mkdir smbshare)
  3. smbmount //machinename/sharename smbshare -ousername=administrator
  4. type in the password
  5. find smbshare -type f \(-name “*.html“ -o -name “*.htm“ -o name “*.php“ \)  | xargs grep -li “mytext“ | xargs sed -i -e 's/mytext/mynewtext/gi'

 

 

posted @ 12:50 PM | Feedback (0)