diamondsandperls has asked for the wisdom of the Perl Monks concerning the following question:
Below is an update but not quite there trying to archive files that begin with the same ip address in a random series all files that begin with the same ip address archive them to the same archive with the archive named whatever the ip is .zip.
#!perl use strict; use warnings; use Modern::Perl; use IO::Compress::Zip qw(zip $ZipError) ; my %files; my @files = <*.txt *.docx>; while (<@filez>) { next unless /^(\d+.\d+.\d+.\d+)/; push @{ $files{$1} }, $_; } for my $ip ( keys %files ) { do { zip $ip => $_ } for @{ $files{$ip} }; }
|
---|
Back to
Seekers of Perl Wisdom