LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Bulk replace email addresses with SED ? (https://www.linuxquestions.org/questions/programming-9/bulk-replace-email-addresses-with-sed-378963/)

wally.nl 11-01-2005 10:14 AM

Bulk replace email addresses with SED ?
 
Hi,

Recently we 'reshuffled' our mailservers so a lot of email addresses have changed. There are still a lot of old adresses on our websites. We do have a list with all 'new@address.com' - 'very@old.address.com' translations. Is it possible to use sed with this list to replace all old addresses in the html pages or would this require more serious programming ? I can reformat this list without any problems if it needs to be in a specific format/use specific delimiters.

Thanks,

Wally.nl

naf 11-01-2005 10:42 AM

Create a sed script such as conv.sed (one conversion per line):
Code:

s/alpha@who\.com/nalpha@whom\.com/g
s/beta@who\.com/ralph@harry\.com/g
s/gamma@who\.com/ford@cork\.org/g
s/old/new/g

You have to escape the periods to avoid regular expression interpretation.
Then run the command:
Code:

sed -f conv.sed yourfile.html


All times are GMT -5. The time now is 06:04 AM.