in reply to Get filename inside each file
So that will replace every line containing the string 'from stuff' in every .txt file in the current directory with 'from stuff where thing = "$d"', where $d is the last two digits of the filename. See. perlrun for info on perl's command-line options, perlre for info on perl's regular expressions and perlvar for info on the $& variable.perl -pi.bak -e '/from stuff/ or next; ($d)=$ARGV=~/(\d\d)\.txt$/; \ s/from stuff/$& where thing = "$d"/' *.txt
_________
broquaint
|
|---|