History log of /freebsd-current/usr.bin/grep/zgrep.sh
Revision Date Author Comments
# d0b2dbfa 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line sh pattern

Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/


# 16e0391f 12-Apr-2021 Mateusz Piotrowski <0mp@FreeBSD.org>

Fix zgrep --version

"zgrep --version" is expected to print the version information in the
same way as "zgrep -V". However, the case handling the --version flag
is never reached, so "zgrep --version" prints:
zgrep: missing pattern
instead of:
grep (BSD grep, GNU compatible) 2.6.0-FreeBSD

Reviewed by: yuripv
Approved by: yuripv (src)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29813


# 1032f7b8 20-Nov-2020 Eugene Grosbein <eugen@FreeBSD.org>

bzgrep: make flag --no-filename work

PR: 248813
MFC after: 1 week


# 63c8336d 01-Oct-2020 Eric van Gyzen <vangyzen@FreeBSD.org>

zgrep: fix exit status with multiple files

zgrep should exit with success when given multiple files and the
pattern is found in at least one file. Prior to this change,
it would exit with success only if the pattern was found in _every_ file.

Reviewed by: dab ngie
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D26616


# c4cbf1fb 20-Jul-2020 Craig Leres <leres@FreeBSD.org>

Fix some regressions with the zgrep(1) wrapper.

- Handle whitespace with long flags that take arguments:

echo 'foo bar' > test
zgrep --regexp='foo bar' test

- Do not hang reading from stdin with patterns in a file:

echo foobar > test
echo foo > pattern
zgrep -f pattern test
zgrep --file=pattern test

- Handle any flags after -e:

echo foobar > test
zgrep -e foo --ignore-case < test

These two are still outstanding problems:

- Does not handle flags that take an argument if there is no
whitespace:

zgrep -enfs /etc/rpc

- When more than one -e pattern used matching should occur for all
patterns (similar to multiple patterns supplied with -f file).
Instead only the last pattern is used for matching:

zgrep -e rex -e nfs /etc/rpc

(This problem is masked in the unpatched version by the "any
flags after -e" problem.)

Add tests for the above problems.

Update the mange and add references to gzip(1) and zstd(1) and also
document the remaining known problems.

PR: 247126
Approved by: markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25613


# 920a817c 24-May-2018 Bryan Drewery <bdrewery@FreeBSD.org>

Fix exit code for mismatches after r333013.

The -c flag still does the wrong thing versus the older version due to
lack of pipefail support.

Reported by: antoine


# 42fd147f 02-May-2018 Kyle Evans <kevans@FreeBSD.org>

zgrep(1): Note that -r/-R are not currently supported.

This is better behavior than just silently doing the wrong thing. We do not
currently have plans to support -r/-R with the compression-enabled greps.

Reported by: jilles


# 6a88262d 25-Apr-2018 Baptiste Daroussin <bapt@FreeBSD.org>

zgrep.sh: Add forgotten ';' and remove set -e which prevents looping over files
not matching


# 1e5b9762 25-Apr-2018 Baptiste Daroussin <bapt@FreeBSD.org>

zgrep.sh: remove now useless shift


# 9fdb4cfa 25-Apr-2018 Baptiste Daroussin <bapt@FreeBSD.org>

zgrep: small improvements

* Use slightly more efficient method to determine the name of the program
called [1]
* Use nicer form to loop over arguments [1]
* add special support for --version along with -V previously added by kevans

Reported by: jilles@ [1]


# 0967ef2a 25-Apr-2018 Kyle Evans <kevans@FreeBSD.org>

<compress>grep: Special case the -V flag

In case we need version information of the ultimately chosen grep, allowing
`zgrep -V` to operate would be most helpful.


# 612c330d 25-Apr-2018 Baptiste Daroussin <bapt@FreeBSD.org>

Use a script wrapper for <compress>grep

Import the wrapper script from zstdgrep (written by wiz@netbsd.org)

Modify it to support more than just zstd (adding support for gzip,
lzma, xz and bzip2)

Write a simple manpage dedicated for it.

Only use that new wrapper both for gnu grep and bsd grep

Next step will be removing code related to compression format from bsdgrep

Reviewed by: kevans
Approved by: kevans
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D15193