in reply to Re^2: searching for a substring in a string
in thread searching for a substring in a string

I don't know if I'm reading you right but: perl -p -i.bkup -e "s/.*(test.*?\.txt).*/test29-01-05\.txt/;" p.txt, might do what you want. (see perlrun)

"Cogito cogito ergo cogito sum - I think that I think, therefore I think that I am." Ambrose Bierce