in reply to ho w to replace a occurence of string by other string
or as a script:perl -npi.bak -e "s:([\w\d]+\.data):testname/$1:g" infile
Update:use strict; $testname="replacement"; open IN, "infile" or die $!; open OUT, ">outfile" or die $!; while ( <IN> ) { s:([\w\d]+\.data):$testname/$1:g print OUT $_; } close IN; close OUT;
|
|---|