http://www.perlmonks.org?node_id=826580


in reply to How to duplicate lines

Something like this?
#!/usr/bin/perl use strict; while (my $line = <DATA>) { print $line; if ( $line =~ /\sip address/ ) { $line =~ s/(\d+.\d+.\d+.)252/${1}100/; print $line; } } __DATA__ ip vrf forwarding ABC:Defgh ip address 1.1.1.1 255.255.255.252 ip vrf forwarding ABD: Efghi ip address 2.2.2.2 255.255.255.252

Replies are listed 'Best First'.
Re^2: How to duplicate lines
by ddrew78 (Beadle) on Mar 05, 2010 at 13:13 UTC
    Great, thank you so much. That did the trick.