I would prefere the solution from Hena, because yours can fail if the last 10 chars repeat anywhere in the string, s/// takes the first match. s/.{10}$/$filename/ is safer here.
Comment on Re: Re: Replacing text inside lots of files
Thanks Taulmarill. After reviewing hena's code, I see the more accurate regexp. But thanks to hena for that regexp--that's going in my arsenal of cool replacement regexps.