Here's a somewhat more elaborate version ...Thanks, Carl, that's really great. I had merely hoped for a simple routine that would search out the first _, replace with mdul, then find the next, and replace with mdnm, etc. until end of file, without asking any embarassing questions. But the program you made is so much more useful in that it deals with the inevitable case that one's attributes are not always correctly balanced.