Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: search and replace plus counter

by Anonymous Monk
on Sep 20, 2013 at 10:28 UTC ( #1054995=note: print w/ replies, xml ) Need Help??


in reply to search and replace plus counter

$ perl -le " for( @ARGV ){ print; s{(.)}{$1.++$counter}ge; print} " a +bc XYZ abc a1b2c3 XYZ X4Y5Z6 ## perl -pTe "s{(core:para edpnum-start=\x22)}{$1.++$counter}ge; " < +test.xml > testcounted.xml ## perl -pi.orig -Te "s{(core:para edpnum-start=\x22)}{$1.++$counter}g +e; " test.xml ## diff -u test.orig test.xml

Write to existing file with character insert (tags: in place edit EDIT AND BACKUP FILES SAFELY ARGV::readonly Iterator::Diamond Iterator::Files -pi.orig -pi.bak )


Comment on Re: search and replace plus counter
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1054995]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2015-07-06 05:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (70 votes), past polls