so one of the offices at the company recently moved from one city to another. they are in the process of migrating the public website from an old static page to a new page using wordpress. if the new site was online, changing a footer with the office address wouldn’t be a problem. well the new shiny office doesn’t come with the new shiny website. had to do some cli kung-fu to get the address changed.
so i figured since line of the address in html was on a separate line the best thing was to grep for the string, then use sed to replace it, it’s not elegant but it worked.
first thing we do, we back up our crap in case i totally screw it up. then once my backups are done i run the first part of the string:
grep -lr -e ‘123 Old Street Location, Floor 3’ * | xargs sed -i ‘s/123 Old Street Location, Floor 3/555 New Street Location Suite 4/g’
then let’s do the new city and zip
grep -lr -e ‘Cambridge, MA 02139 USA’ * | xargs sed -i ‘s/Cambridge, MA 02139 USA/Boston, MA 02111 USA/g’
this got the job done and quickly since the problem was sitting around for a little while and no one seemed to notice.