in reply to Re^5: needing to zip files in a series that begin with the same IP address
in thread needing to zip files in a series that begin with the same IP address
#!perl use Modern::Perl; use IO::Compress::Zip qw(zip $ZipError) ; my %files; my @files = <*.txt *.docx>; for (@files) { next unless /^(\d+.\d+.\d+.\d+)/; push @{ $files{$1} }, $_; } for my $ip ( keys %files ) { my $output = "$ip.zip"; do { zip => $output, $ip -> $_ } for @{ $files{$ip} }; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: needing to zip files in a series that begin with the same IP address
by Kenosis (Priest) on Jul 27, 2012 at 22:55 UTC |