perl -pe 's:(\w+\.data)\b:testname/$1:g' output