in reply to replace number by args<number>
Try MSAR.
In file:
1:2 -p 1 -t 2 3 1 2
Map file:
1 arg1 2 arg2 3 arg3
Output:
{C} > msar in.txt map.txt Reading mappings from file: map.txt ---------------------------- arg1:arg2 -p arg1 -t arg2 arg3 arg1 arg2 ---------------------------- Mapped 7 entries.
You can review the coding in MSAR.pl, but I think you'll be interested in the regex:
($_ =~ s/$replace/$map{$replace}/gi)
|
|---|