Skip to content

Instantly share code, notes, and snippets.

@pfaffman pfaffman/fixnames
Last active Mar 31, 2016

What would you like to do?
#!/usr/bin/env bash
# fixnames
# Jay Pfaffman <>
# Available from
if [ $# -lt 1 ]
echo "Usage " $0 files
echo " Replaces names (or any words) in files passed on the command line."
echo " Edit below to change what names get replaced."
# According to:
# on OS X you'll need to use [[:<:]] and [[:>:]] for word boundary.
# Using \b or \< just doesn't work.
# For each first and last name, duplicate the sed line below to replace in all
# of the documents passed on the command line.
# Sites like will give you lists of names.
for file in $*
echo -n "Processing " $file ". . . "
# Stick in as many names like these as you need to
# Whatever is in the first field between the /'s will be replaced by the second field.
sed --in-place -e 's/\<OLDNAME\>/NEWNAME/g' $file
echo done.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.