in reply to Writing a new file in Perl
use strictures; use Regexp::Common qw/net/; use autodie qw(:all); open my $in, '<:raw', 'Samplle_2.txt'; open my $out, '>:raw', 'Google_1'; while (my $line = <$in>) { my ($ip) = $line =~ /(?: \d+ [ ] ms \s+ ){3} ($RE{net}{IPv4})/msx; print {$out} "$ip\n" if defined $ip; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Writing a new file in Perl
by maheshkumar (Sexton) on Jul 05, 2012 at 11:44 UTC | |
by maheshkumar (Sexton) on Jul 11, 2012 at 11:31 UTC | |
by daxim (Curate) on Jul 11, 2012 at 14:41 UTC | |
by maheshkumar (Sexton) on Jul 11, 2012 at 15:05 UTC | |
|
Re^2: Writing a new file in Perl
by Anonymous Monk on Jul 05, 2012 at 11:48 UTC | |
by daxim (Curate) on Jul 11, 2012 at 14:40 UTC |