diamondsandperls,
Perhaps our continued conversation got buried in the nested postings above. However, assembling the suggestions in those postings (plus a couple of minor tweaks) into a single script yields the following:
use Modern::Perl; use IO::Compress::Zip qw(zip $ZipError); my %files; for (<*.txt *.docx>) { next unless /^(\d+.\d+.\d+.\d+)/; chomp; push @{ $files{$1} }, $_; } for my $ip ( keys %files ) { say 'Adding ' . @{ $files{$ip} } . " file(s) to archive $ip.zip"; zip \@{ $files{$ip} } => "$ip.zip" or die "zip failed: $ZipError\n +"; } say 'Done!';
In reply to Re: needing to zip files in a series that begin with the same IP address
by Kenosis
in thread needing to zip files in a series that begin with the same IP address
by diamondsandperls
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |