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'

 

 

Post Comment

Title  
Name  
Url
Comment   

ATTENTION: the code you need to copy is CaSe SeNsItIvE and is required to prevent spam.
Enter the code you see: