#!/usr/bin/perl use strict ; use warnings ; use Compress::Zlib ; die "Usage: gzgrep pattern file...\n" unless @ARGV >= 2; my $pattern = shift ; my $file ; foreach $file (@ARGV) { my $gz = gzopen($file, "rb") or die "Cannot open $file: $gzerrno\n" ; while ($gz->gzreadline($_) > 0) { print if /$pattern/ ; } die "Error reading from $file: $gzerrno\n" if $gzerrno != Z_STREAM_END ; $gz->gzclose() ; }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
filtdef | File | 437 B | 0644 |
|
filtinf | File | 470 B | 0644 |
|
gzcat | File | 495 B | 0644 |
|
gzgrep | File | 463 B | 0644 |
|
gzstream | File | 314 B | 0644 |
|