This was the code I used in JOSM:

from org.openstreetmap.josm.command import ChangePropertyCommand, SequenceCommand
from org.openstreetmap.josm.gui import MainApplication

def println(x):
	from org.openstreetmap.josm.plugins.scripting.ui.console import ScriptingConsole
	ScriptingConsole.getInstance().getScriptLog().getLogWriter().println(x)

# equal and non-null
def enn(x, y):
	return x and y and x == y

def check(way, x, y):
	if enn(way.get(x), way.get(y)):
		return ChangePropertyCommand(way, x, None)
	return None

layer = MainApplication.getLayerManager().getEditLayer()
cmds = []
for way in layer.data.getWays():
	cmds.append(check(way, 'tiger:name_base', 'name'))
	cmds.append(check(way, 'tiger:name_base_1', 'name_1'))
	cmds.append(check(way, 'tiger:name_base_2', 'name_2'))
	cmds.append(check(way, 'tiger:name_base_3', 'name_3'))
cmds = filter(None, cmds)
seq = SequenceCommand('Remove redundant name_bases', cmds)
seq.executeCommand()
