Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
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 musing on the Monastery: (3)
As of 2025-02-07 14:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which URL do you most often use to access this site?












    Results (94 votes). Check out past polls.