#!/bin/sh # xzgrep -- a wrapper around a grep program that decompresses files as needed # Adapted from a version sent by Charles Levert <charles@comm.polymtl.ca> # Copyright (C) 1998, 2001, 2002, 2006, 2007 Free Software Foundation # Copyright (C) 1993 Jean-loup Gailly # Modified for XZ Utils by Andrew Dudman and Lasse Collin. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. #SET_PATH - This line is a placeholder to ease patching this script. # Instead of unsetting XZ_OPT, just make sure that xz will use file format # autodetection. This way memory usage limit and thread limit can be # specified via XZ_OPT. With gzip, bzip2, and lzop it's OK to just unset the # environment variables. xz='xz --format=auto' unset GZIP BZIP BZIP2 LZOP case ${0##*/} in *egrep*) prog=xzegrep; grep=${GREP:-egrep};; *fgrep*) prog=xzfgrep; grep=${GREP:-fgrep};; *) prog=xzgrep; grep=${GREP:-grep};; esac version="$prog (XZ Utils) 5.2.2" usage="Usage: ${0##*/} [OPTION]... [-e] PATTERN [FILE]... Look for instances of PATTERN in the input FILEs, using their uncompressed contents if they are compressed. OPTIONs are the same as for '$grep'. Report bugs to <lasse.collin@tukaani.org>." # sed script to escape all ' for the shell, and then (to handle trailing # newlines correctly) turn trailing X on last line into '. escape=' s/'\''/'\''\\'\'''\''/g $s/X$/'\''/ ' operands= have_pat=0 files_with_matches=0 files_without_matches=0 no_filename=0 with_filename=0 while test $# -ne 0; do option=$1 shift optarg= case $option in (-[0123456789abcdhHiIKLlnoqrRsTuUvVwxyzZ]?*) arg2=-\'$(expr "X${option}X" : 'X-.[0-9]*\(.*\)' | sed "$escape") eval "set -- $arg2 "'${1+"$@"}' option=$(expr "X$option" : 'X\(-.[0-9]*\)');; (--binary-*=* | --[lm]a*=* | --reg*=*) ;; (-[ABCDefm] | --binary-* | --file | --[lm]a* | --reg*) case ${1?"$option option requires an argument"} in (*\'*) optarg=" '"$(printf '%sX\n' "$1" | sed "$escape");; (*) optarg=" '$1'";; esac shift;; (--) break;; (-?*) ;; (*) case $option in (*\'*) operands="$operands '"$(printf '%sX\n' "$option" | sed "$escape");; (*) operands="$operands '$option'";; esac ${POSIXLY_CORRECT+break} continue;; esac case $option in (-[drRzZ] | --di* | --exc* | --inc* | --rec* | --nu*) printf >&2 '%s: %s: Option not supported\n' "$0" "$option" exit 2;; (-[ef]* | --file | --file=* | --reg*) have_pat=1;; (--h | --he | --hel | --help) echo "$usage" || exit 2 exit;; (-H | --wi | --wit | --with | --with- | --with-f | --with-fi \ | --with-fil | --with-file | --with-filen | --with-filena | --with-filenam \ | --with-filename) with_filename=1 continue;; (-l | --files-with-*) files_with_matches=1 continue;; (-L | --files-witho*) files_without_matches=1 continue;; (-h | --no-f*) no_filename=1;; (-V | --v | --ve | --ver | --vers | --versi | --versio | --version) echo "$version" || exit 2 exit;; esac case $option in (*\'?*) option=\'$(expr "X${option}X" : 'X\(.*\)' | sed "$escape");; (*) option="'$option'";; esac grep="$grep $option$optarg" done if test $files_with_matches -eq 1 || test $files_without_matches -eq 1; then grep="$grep -q" fi eval "set -- $operands "'${1+"$@"}' if test $have_pat -eq 0; then case ${1?"Missing pattern; try \`${0##*/} --help' for help"} in (*\'*) grep="$grep -- '"$(printf '%sX\n' "$1" | sed "$escape");; (*) grep="$grep -- '$1'";; esac shift fi if test $# -eq 0; then set -- - fi exec 3>&1 # res=1 means that no file matched yet res=1 for i; do case $i in *[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) uncompress="gzip -cdfq";; *[-.]bz2 | *[-.]tbz | *.tbz2) uncompress="bzip2 -cdfq";; *[-.]lzo | *[-.]tzo) uncompress="lzop -cdfq";; *) uncompress="$xz -cdfq";; esac # Fail if xz or grep (or sed) fails. xz_status=$( exec 5>&1 ($uncompress -- "$i" 5>&-; echo $? >&5) 3>&- | if test $files_with_matches -eq 1; then eval "$grep" && { printf '%s\n' "$i" || exit 2; } elif test $files_without_matches -eq 1; then eval "$grep" || { r=$? if test $r -eq 1; then printf '%s\n' "$i" || r=2 fi exit $r } elif test $with_filename -eq 0 && { test $# -eq 1 || test $no_filename -eq 1; }; then eval "$grep" else # Append a colon so that the last character will never be a newline # which would otherwise get lost in shell command substitution. i="$i:" # Escape & \ | and newlines only if such characters are present # (speed optimization). case $i in (*' '* | *'&'* | *'\'* | *'|'*) i=$(printf '%s\n' "$i" | LC_ALL=C sed 's/[&\|]/\\&/g; $!s/$/\\/');; esac # $i already ends with a colon so don't add it here. sed_script="s|^|$i|" # Fail if grep or sed fails. r=$( exec 4>&1 (eval "$grep" 4>&-; echo $? >&4) 3>&- | LC_ALL=C sed "$sed_script" >&3 4>&- ) || r=2 exit $r fi >&3 5>&- ) r=$? # fail occured previously, nothing worse can happen test $res -gt 1 && continue test "$xz_status" -eq 0 || test "$xz_status" -eq 2 \ || test "$(kill -l "$xz_status" 2> /dev/null)" = "PIPE" || r=2 # still no match test $r -eq 1 && continue # 0 == match, >=2 == fail res=$r done exit $res
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
README | File | 100 B | 0644 |
|
aclocal | File | 35.93 KB | 0755 |
|
aclocal.1.gz | File | 1.18 KB | 0644 |
|
automake | File | 247.38 KB | 0755 |
|
automake.1.gz | File | 1.57 KB | 0644 |
|
awk | File | 642.65 KB | 0755 |
|
awk.1.gz | File | 28.17 KB | 0644 |
|
builtins.7.gz | File | 508 B | 0644 |
|
c++ | File | 1022.94 KB | 0755 |
|
c++.1.gz | File | 297.02 KB | 0644 |
|
c89 | File | 428 B | 0755 |
|
c89.1.gz | File | 1.33 KB | 0644 |
|
c99 | File | 454 B | 0755 |
|
c99.1.gz | File | 1.39 KB | 0644 |
|
cc | File | 1022.94 KB | 0755 |
|
cc.1.gz | File | 297.02 KB | 0644 |
|
cpp | File | 1022.94 KB | 0755 |
|
desktop-background | File | 13.66 KB | 0644 |
|
desktop-background.xml | File | 643 B | 0644 |
|
desktop-grub | File | 154.66 KB | 0644 |
|
desktop-splash | File | 309.33 KB | 0644 |
|
editor | File | 240.11 KB | 0755 |
|
editor.1.gz | File | 5.34 KB | 0644 |
|
ex | File | 2.55 MB | 0755 |
|
ex.1.gz | File | 5.29 KB | 0644 |
|
ex.fr.1.gz | File | 6.37 KB | 0644 |
|
ex.it.1.gz | File | 5.96 KB | 0644 |
|
ex.ja.1.gz | File | 5.79 KB | 0644 |
|
ex.pl.1.gz | File | 6.15 KB | 0644 |
|
ex.ru.1.gz | File | 6.96 KB | 0644 |
|
faked.1.gz | File | 1.16 KB | 0644 |
|
faked.es.1.gz | File | 1.42 KB | 0644 |
|
faked.fr.1.gz | File | 1.49 KB | 0644 |
|
faked.sv.1.gz | File | 1.32 KB | 0644 |
|
fakeroot | File | 3.76 KB | 0755 |
|
fakeroot.1.gz | File | 3.91 KB | 0644 |
|
fakeroot.es.1.gz | File | 4.38 KB | 0644 |
|
fakeroot.fr.1.gz | File | 4.59 KB | 0644 |
|
fakeroot.sv.1.gz | File | 4.26 KB | 0644 |
|
from | File | 9.99 KB | 0755 |
|
from.1.gz | File | 1.43 KB | 0644 |
|
ftp | File | 98.7 KB | 0755 |
|
ftp.1.gz | File | 9.02 KB | 0644 |
|
futurize | File | 384 B | 0755 |
|
infobrowser | File | 245.72 KB | 0755 |
|
infobrowser.1.gz | File | 1.4 KB | 0644 |
|
jsondiff | File | 1018 B | 0755 |
|
jsonpatch | File | 3.58 KB | 0755 |
|
jsonpointer | File | 1.31 KB | 0755 |
|
jsonschema | File | 398 B | 0755 |
|
locate | File | 42.08 KB | 2755 |
|
locate.1.gz | File | 2.58 KB | 0644 |
|
lzcat | File | 74.36 KB | 0755 |
|
lzcat.1.gz | File | 19.87 KB | 0644 |
|
lzcmp | File | 6.48 KB | 0755 |
|
lzcmp.1.gz | File | 664 B | 0644 |
|
lzdiff | File | 6.48 KB | 0755 |
|
lzdiff.1.gz | File | 664 B | 0644 |
|
lzegrep | File | 5.76 KB | 0755 |
|
lzegrep.1.gz | File | 700 B | 0644 |
|
lzfgrep | File | 5.76 KB | 0755 |
|
lzfgrep.1.gz | File | 700 B | 0644 |
|
lzgrep | File | 5.76 KB | 0755 |
|
lzgrep.1.gz | File | 700 B | 0644 |
|
lzless | File | 1.76 KB | 0755 |
|
lzless.1.gz | File | 743 B | 0644 |
|
lzma | File | 74.36 KB | 0755 |
|
lzma.1.gz | File | 19.87 KB | 0644 |
|
lzmore | File | 2.11 KB | 0755 |
|
lzmore.1.gz | File | 636 B | 0644 |
|
mt | File | 78.63 KB | 0755 |
|
mt.1.gz | File | 1.98 KB | 0644 |
|
my.cnf | File | 1.28 KB | 0644 |
|
nawk | File | 642.65 KB | 0755 |
|
nawk.1.gz | File | 28.17 KB | 0644 |
|
nc | File | 34.48 KB | 0755 |
|
nc.1.gz | File | 6.12 KB | 0644 |
|
netcat | File | 34.48 KB | 0755 |
|
netcat.1.gz | File | 6.12 KB | 0644 |
|
netrc.5.gz | File | 2.04 KB | 0644 |
|
newt-palette | File | 160 B | 0644 |
|
pager | File | 166.76 KB | 0755 |
|
pager.1.gz | File | 20.01 KB | 0644 |
|
pasteurize | File | 388 B | 0755 |
|
pbr | File | 152 B | 0755 |
|
pftp | File | 98.7 KB | 0755 |
|
pftp.1.gz | File | 9.02 KB | 0644 |
|
phar | File | 14.47 KB | 0755 |
|
phar.1.gz | File | 2.74 KB | 0644 |
|
phar.phar | File | 14.47 KB | 0755 |
|
phar.phar.1.gz | File | 36 B | 0644 |
|
php | File | 4.68 MB | 0755 |
|
php.1.gz | File | 3.54 KB | 0644 |
|
pico | File | 240.11 KB | 0755 |
|
pico.1.gz | File | 5.34 KB | 0644 |
|
pinentry | File | 62.49 KB | 0755 |
|
pinentry.1.gz | File | 1.38 KB | 0644 |
|
rcp | File | 98.14 KB | 0755 |
|
rcp.1.gz | File | 2.35 KB | 0644 |
|
rlogin | File | 710.79 KB | 0755 |
|
rlogin.1.gz | File | 14.25 KB | 0644 |
|
rmt | File | 58.39 KB | 0755 |
|
rmt.8.gz | File | 2.34 KB | 0644 |
|
rsh | File | 710.79 KB | 0755 |
|
rsh.1.gz | File | 14.25 KB | 0644 |
|
rview | File | 2.55 MB | 0755 |
|
rvim | File | 2.55 MB | 0755 |
|
shimx64.efi.signed | File | 937.96 KB | 0644 |
|
telnet | File | 108.42 KB | 0755 |
|
telnet.1.gz | File | 8.8 KB | 0644 |
|
text.plymouth | File | 205 B | 0644 |
|
traceroute6 | File | 18.02 KB | 4755 |
|
traceroute6.8.gz | File | 925 B | 0644 |
|
unlzma | File | 74.36 KB | 0755 |
|
unlzma.1.gz | File | 19.87 KB | 0644 |
|
updatedb | File | 46.08 KB | 0755 |
|
updatedb.8.gz | File | 2.08 KB | 0644 |
|
vi | File | 2.55 MB | 0755 |
|
vi.1.gz | File | 5.29 KB | 0644 |
|
vi.fr.1.gz | File | 6.37 KB | 0644 |
|
vi.it.1.gz | File | 5.96 KB | 0644 |
|
vi.ja.1.gz | File | 5.79 KB | 0644 |
|
vi.pl.1.gz | File | 6.15 KB | 0644 |
|
vi.ru.1.gz | File | 6.96 KB | 0644 |
|
view | File | 2.55 MB | 0755 |
|
view.1.gz | File | 5.29 KB | 0644 |
|
view.fr.1.gz | File | 6.37 KB | 0644 |
|
view.it.1.gz | File | 5.96 KB | 0644 |
|
view.ja.1.gz | File | 5.79 KB | 0644 |
|
view.pl.1.gz | File | 6.15 KB | 0644 |
|
view.ru.1.gz | File | 6.96 KB | 0644 |
|
vim | File | 2.55 MB | 0755 |
|
vimdiff | File | 2.55 MB | 0755 |
|
vtrgb | File | 158 B | 0644 |
|
w | File | 18.07 KB | 0755 |
|
w.1.gz | File | 1.25 KB | 0644 |
|
write | File | 13.99 KB | 2755 |
|
write.1.gz | File | 1.8 KB | 0644 |
|
x-cursor-theme | File | 30 B | 0644 |
|
x-session-manager | File | 2.9 KB | 0755 |
|
x-session-manager.1.gz | File | 582 B | 0644 |
|
x-terminal-emulator | File | 2.36 KB | 0755 |
|
x-terminal-emulator.1.gz | File | 1.2 KB | 0644 |
|
x-window-manager | File | 382.26 KB | 0755 |
|
x-window-manager.1.gz | File | 698 B | 0644 |
|