in reply to Re: How to duplicate lines
in thread How to duplicate lines

Thanks to everyone for the quick responses. However, I made a crucial mistake when I showed what it needs to become. What I actually need to change it to needs to be
ip vrf forwarding ABC:Defgh ip address 1.1.1.1 255.255.255.252 ip address 1.1.1.1 255.255.255.100 ip vrf forwarding ABD: Efghi ip address 2.2.2.2 255.255.255.252 ip address 2.2.2.2 255.255.255.100
The last part of the duplicated line needs to change as it is being copied. Is there any way of doing this?

Replies are listed 'Best First'.
Re^3: How to duplicate lines
by lidden (Curate) on Mar 04, 2010 at 01:28 UTC
    Change the code given above to:

    perl -pe'$_ .= $_, s/252$/100/  if /^ip address/'