Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: needing to zip files in a series that begin with the same IP address

by diamondsandperls (Beadle)
on Jul 27, 2012 at 20:41 UTC ( #984096=note: print w/ replies, xml ) Need Help??


in reply to needing to zip files in a series that begin with the same IP address

i feel im getting closer i failed to mention i need the output files to be the ip address e.g. 192.168.1.1.zip.

#!perl #use strict; use warnings; use IO::Compress::Zip qw(zip $ZipError) ; my @textfiles = <*.txt *.docx>; foreach my $textfile (@textfiles) { if ($textfile =~ /(\d+.\d+.\d+.\d+.*)/) { my $ip = $textfile =~ /(\d+.\d+.\d+.\d+).*/; my $files; push @{$files{$ip}}, $textfile; zip $textfile => $output or die "zip failed\n"; } }


Comment on Re: needing to zip files in a series that begin with the same IP address
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://984096]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2015-07-30 03:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls