String Replacement
This tool was designed to go through text files (meaning: text, html, php, etc.) to search for and replace a particular text string (or regular expression). This is useful in the following scenarios:

  • Need to update information in every page of a website (i.e. change the contact's email address or phone number), without using templates.
  • Remove bogus tags inserted into HTML documents by programs such as Microsoft Word and it's <o:p> tag that does nothing other than add difficulty for those who read HTML.

The program was written in perl and will run on standard Linux systems as well as Windows (through ActivePerl). It requires no configuration on systems already running perl. See below for usage information

Magnifying GLass

Download:

Version 0.1
Linux Download

Linux

tar -jxvf string_replace-0.1.tar.bz2

Windows Download

Windows

unzip string_replace-0.1.zip

Install

To install this program system-wide, simply place string_replace.pl into your path.

Usage:

Command Explanation
string_replace.pl "user@domain.com" "newuser@newdomain.com" Changes the email address that appears on every page
string_replace.pl "<o:p>" "" Removes all occurrences of <o:p> (because the second argument is blank)
string_replacement.pl
     Enter the phrase to replace: <o:p>
     Enter the phrase to replace it with: (just hit enter)

If you don't provide any arguments, the program will prompt them.

Press ctrl+c to cancel the program if you make a mistake.


Code: