Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: How to duplicate lines

by jrsimmon (Hermit)
on Mar 03, 2010 at 22:23 UTC ( [id://826548]=note: print w/replies, xml ) Need Help??


in reply to How to duplicate lines

use strict; my $pattern = 'ip address'; open IN_FILE, '<', 'some_file' or die $!; open OUT_FILE, '>', 'some_other_file' or die $!; while(my $line = <FILE>){ print OUT_FILE $line; print OUT_FILE $line if $line =~ /^$pattern/; } close(IN_FILE); close(OUT_FILE);

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2026-02-08 05:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.