Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: How to duplicate lines

by bichonfrise74 (Vicar)
on Mar 04, 2010 at 00:06 UTC ( #826580=note: print w/ replies, xml ) Need Help??


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


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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (11)
As of 2015-07-29 17:36 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 (266 votes), past polls