### Batch replace: Grab characters from elsewhere in the source?

Posted:

**Mon Jan 31, 2005 5:32 pm**I have a batch configuration I run from time to time to edit code.

In the code, I have these 2 lines that appear like this:

SR:SC20050BOX

PR:3120001

...and this:

SR:SC20050BOX

PR:3120002

...and this:

SR:SC20050BOX

PR:3120003

...and so on. The last 3 digits of the "PR" line is a counter, basically. The numbers are unique, are always 3 digits, but not necessarily in numerical order.

I need to change the letters "BOX" to the 3-digits from the end of the "PR" line, so I end up with this instead:

SR:SC20050001

PR:3120001

SR:SC20050002

PR:3120002

SR:SC20050003

PR:3120003

Can AF&R do this? And how?

In the code, I have these 2 lines that appear like this:

SR:SC20050BOX

PR:3120001

...and this:

SR:SC20050BOX

PR:3120002

...and this:

SR:SC20050BOX

PR:3120003

...and so on. The last 3 digits of the "PR" line is a counter, basically. The numbers are unique, are always 3 digits, but not necessarily in numerical order.

I need to change the letters "BOX" to the 3-digits from the end of the "PR" line, so I end up with this instead:

SR:SC20050001

PR:3120001

SR:SC20050002

PR:3120002

SR:SC20050003

PR:3120003

Can AF&R do this? And how?