--- /dev/null
+#!/usr/bin/env python
+
+
+import sys
+from os.path import basename
+
+if len(sys.argv) < 2:
+ print 'usage: %s file0 [file1 [file2...]]' % sys.argv[0]
+ sys.exit(1)
+
+for fpath in sys.argv[1:]:
+ fname = basename(fpath)
+
+ fp = open(fpath)
+ lines = fp.readlines()
+ fp.close()
+ if lines[0][0:7] == 'Element':
+ fields = lines[0].split()
+ if fields[1] == fname or fields[1] == '"'+fname+'"':
+ print 'Not touching:', fpath
+ else:
+ fields[1] = '"%s"' % fname
+ #put back the split() trailing newline
+ lines[0] = ' '.join(fields) + '\n'
+ print 'Rewriting:', fpath
+ open(fpath, 'w').write(''.join(lines))
+