I cannot reproduce your results on ActivePerl for Windows. Are you sure each "orgtext" is on a different line? $. is the current input line number, not the number of substitutions performed.
| a.html | b.html | |
| Before |
|
|
| After |
|
|
Perhaps you want
perl -pi -e 's/orgtext/++$x/eg;' *.html
| a.html | b.html | |
| After |
|
|
or
perl -pi -e 's/orgtext/++$x/eg; $x=0 if eof(ARGV)' *.html
| a.html | b.html | |
| After |
|
|
Update: Compacted node by replacing lists with tables.
In reply to Re: command line replace incorrectly indexes $.
by ikegami
in thread command line replace incorrectly indexes $.
by cmarcum
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |