Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Feb 2022 15:22:40 +0000
From:      Frank Leonhardt <freebsd-doc@fjl.co.uk>
To:        questions@freebsd.org
Subject:   Re: bzgrep question.
Message-ID:  <3a5f199c-20c8-4216-9b03-8ac8d38018ec@fjl.co.uk>
In-Reply-To: <623c3a-36fb-bfb3-bc39-508a31f0f39@safeport.com>
References:  <623c3a-36fb-bfb3-bc39-508a31f0f39@safeport.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On 05/02/2022 19:04, doug wrote:
> On a 12.1 system `bzgrep -f` does not work.
>
>> uname -a
> FreeBSD freeport.safeport.com 12.1-RELEASE-p8 FreeBSD 12.1-RELEASE-p8 
> GENERIC  amd64
>
>> bzgrep -f /tmp/ids maillog.0.bz2
> bzcat: I won't read compressed data from a terminal.
> bzcat: For help, type: `bzcat --help'.
> --------------
>> bzcat maillog.0.bz2 | grep -f /tmp/ids | head
> Feb  4 00:14:29 freeport postfix/qmgr[47890]: C502C3B8AE8: 
> from=<doug@widgets.com>, size=37455, nrcpt=3 (queue active)
> Feb  4 00:14:29 freeport postfix/qmgr[47890]: AAB0B1793D2: from=<>, 
> size=6262, nrcpt=1 (queue active)
>
> I know this has worked on other 12.1 systems but currently I only have 
> this one.
>
>

As far as I know, ALL options to zgrep are passed unchanged to grep. 
Bearing this in mind you're getting exactly what I'd expect. "-f 
/tmp/ids maillog.0.bz2" is telling grep to get it's patterns from the 
file (good luck with that), and as there's no remainder of the line it's 
being asked to read the data to search from stdin (the terminal at this 
stage). Probably not what you wanted.

I could be wrong about what -f does, but my understanding is that the 
next argument is the file to read the patterns from.

Regards, Frank.






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3a5f199c-20c8-4216-9b03-8ac8d38018ec>