Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re^2: Decoding .z and .gz files

by blackadder (Hermit)
on Mar 27, 2007 at 08:42 UTC ( [id://606716] : note . print w/replies, xml ) Need Help??

in reply to Re: Decoding .z and .gz files
in thread Decoding .z and .gz files

IT WORKED,....Thanks for all the replies

I used "Gunzip.exe" on the .z files!

Here is the full code
#! c:/perl/bin/perl.exe # # By a PerlMonk # use strict; use Archive::Tar; my $tar = Archive::Tar->new(); system(cls); opendir (DIR, $ARGV[0]) || die "\nInvalid path $ARGV[0]!\n"; my @path = readdir (DIR); for my $comp_file (@path) { next if ($comp_file eq '.' || $comp_file eq '..'); my $temp_path = "$ARGV[0]\\$comp_file"; `gunzip.exe $temp_path` if ($comp_file =~ /\.z$/); my $tar = Archive::Tar->new(); $tar->read("$temp_path", 1); @_ = $tar->list_files(); for my $compressed (@_) { next unless ($compressed =~ /modinfo.txt/); $tar->extract_file( $compressed, "$ARGV[0]\\extracted_modinfo. +txt"); open(FILE,"$ARGV[0]\\extracted_modinfo.txt") || warn "$!: Cann +ot access temp file\n"; chomp (my @vx_data = <FILE>); for my $vx (@vx_data) { next unless ($vx =~ /vx/); $vx =~ s/^\s+//; $vx =~ /(\w+)\s+(\w+)\s+(\w+)\s+(\d+)\s+(\d+)\s+(\w+)\s+\( +(.+)\)$/; printf "%s, %s,%s,%s,%s,%s,%s,(%s)\n",$comp_file,$1,$2,$3, +$4,$5,$6,$7; } close (FILE); unlink ("$ARGV[0]\\extracted_modinfo.txt"); } }
Thanks again "feel an urge for a donation now! :-)"