in reply to command line replace incorrectly indexes $.
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: command line replace incorrectly indexes $.
by Anonymous Monk on Oct 18, 2007 at 00:26 UTC | |
by ikegami (Patriarch) on Oct 18, 2007 at 00:31 UTC | |
by cmarcum (Initiate) on Oct 18, 2007 at 00:48 UTC | |
by ikegami (Patriarch) on Oct 18, 2007 at 01:01 UTC |