Try this python script:
$ cat script.py
#!/usr/bin/python
import re
from bs4 import BeautifulSoup
soup = BeautifulSoup(open('allcases'), features="xml")
for tag in soup.findAll('Name'):
for name in 'Jason Ignacio', 'Jason', 'Jim':
tag.string = re.sub(r'\b%s\b' % name, len(name)*'X', tag.string)
print(str(soup))
This code is compatible with either python2 or python3.
To make it work, you may need to install the BeautifulSoup module. On a debian-like system:
apt-get install python-bs4
Or, for python3:
apt-get install python3-bs4
Example
Let's consider this input file:
$ cat cases
Jason
Jason
Jason
Jim
Jim
Jim
Jim
Jason Ignacio
Jason Ignacio
Let's run our script and observe the output:
$ python script.py
Jason
XXXXX
Jason
XXX
Jim
XXX
XXX
XXXXX Ignacio
XXXXXXXXXXXXX
Note that the names in tags are left alone. The code only changes the names in tags.
Also, as per the design, Jim, Jason, and Jason Ignacio are changed to X's but other names are left alone. Even Ignacio, if it appears without an adjacent Jason, is left alone.