This one is quite easy, but a little tricky. Had to do this for work as one of our groups was changing their email address and a few of the repo’s they used had files that depended on that email.

A couple requirements to keep in mind:

  1. Had to be recursive
  2. Had to excude certain file types
  3. Had to do the replacement in an svn repository, which apparantly is difficult.

Here is what I came up with that works pretty well:

grep -rsl --exclude='*.crt' --exclude='*.pem' "[email protected]" | xargs sed -i 's/old@company\.net/new@company\.net/g'

And then I needed to commit:

svn commit -m "these files have been modified to reflect the new [email protected] email address we are utilizing."

Done!

Mario Loria is a builder of diverse infrastructure with modern workloads on both bare-metal and cloud platforms. He's traversed roles in system administration, network engineering, and DevOps. You can learn more about him here.