in reply to Re: Need to parse a file within a zip fille
in thread Need to parse a file within a zip fille

i actually made some progress on my own, but still not there yet
use warnings; use Archive::Zip; my $zip = Archive::Zip->new('test.zip'); # my $fh = $zip->memberNamed( { $zip => 'test1.txt'} ); my @members = $zip->memberNames(); # foreach my $member (@members) { # print $member."\n"; # } open OUT,">kiop_data.txt" or die "Cant open kiop_data.txt : $! \n "; open my $file,"<$fh" or die "cant open \'$fh\' : $! \n"; my $lines = @$file[196609]; # print $Lines[196609]."\n"; close IN; close OUT;
now i know it sees the files within the zip i just need to open that particular file up and load every line in an array.

Replies are listed 'Best First'.
Re^3: Need to parse a file within a zip fille
by edimusrex (Monk) on Apr 23, 2015 at 20:58 UTC

    I would probably do something like this although I don't know what kind of stress on the machine this would do since it's loading it into the buffer and not sure how it would react with a file that large


    #!/usr/bin/perl use strict ; use warnings ; use IO::Uncompress::Unzip qw(unzip $UnzipError) ; my $input = 'test.zip'; my $output ; unzip $input => \$output, Name => "test1.txt" or die "unzip failed: $U +nzipError\n"; my @lines = split("\n",$output); print $lines[196609];