aboutsummaryrefslogtreecommitdiff
path: root/src/scripts/xzgrep
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2009-04-13 14:49:48 +0300
committerLasse Collin <lasse.collin@tukaani.org>2009-04-13 14:49:48 +0300
commit2f0bc9cd40f709152a0177c8e585c0757e9af9c9 (patch)
tree465625f251e5167cc749c004a679f3601f616606 /src/scripts/xzgrep
parentPut the interesting parts of XZ Utils into the public domain. (diff)
downloadxz-2f0bc9cd40f709152a0177c8e585c0757e9af9c9.tar.xz
Quick & dirty update to support xz in diff/grep/more scripts.
Diffstat (limited to '')
-rwxr-xr-xsrc/scripts/xzgrep (renamed from src/scripts/lzgrep)10
-rw-r--r--src/scripts/xzgrep.1 (renamed from src/scripts/lzgrep.1)48
2 files changed, 37 insertions, 21 deletions
diff --git a/src/scripts/lzgrep b/src/scripts/xzgrep
index c872df4e..e359378b 100755
--- a/src/scripts/lzgrep
+++ b/src/scripts/xzgrep
@@ -1,7 +1,7 @@
#!/bin/sh
-# lzgrep -- a wrapper around a grep program that decompresses files as needed
-# Adapted to LZMA utils from gzip-1.3.3 + Red Hat's security patches
+# xzgrep -- a wrapper around a grep program that decompresses files as needed
+# Adapted to XZ Utils from gzip-1.3.3 + Red Hat's security patches
# Adapted from a version sent by Charles Levert <charles@comm.polymtl.ca>
# Copyright (C) 1998, 2001 Free Software Foundation
# Copyright (C) 1993 Jean-loup Gailly
@@ -82,20 +82,20 @@ while test $# -ne 0; do
done
if test -z "$pat"; then
- echo "grep through lzma files"
+ echo "grep through .xz and .lzma files"
echo "usage: $prog [grep_options] pattern [files]"
exit 1
fi
if test $# -eq 0; then
- lzma -dc | $grep $opt "$pat"
+ xz -dc | $grep $opt "$pat"
exit $?
fi
res=0
trap break SIGPIPE
for i do
- lzma -dc "$i" |
+ xz -dc -- "$i" |
if test $files_with_matches -eq 1; then
$grep $opt "$pat" > /dev/null && printf "%s\n" "$i"
elif test $files_without_matches -eq 1; then
diff --git a/src/scripts/lzgrep.1 b/src/scripts/xzgrep.1
index 65e344dd..d8647f2a 100644
--- a/src/scripts/lzgrep.1
+++ b/src/scripts/xzgrep.1
@@ -1,23 +1,33 @@
-.TH LZGREP 1 "24 Jun 2005" "LZMA utils"
+.\" Original file was take from gzip, thus this man page is under GNU GPLv2+.
+.TH XZGREP 1 "2009-04-13" "XZ Utils"
.SH NAME
-lzgrep \- search LZMA compressed files for a regular expression
+xzgrep \- search .xz and .lzma compressed files for a regular expression
.SH SYNOPSIS
-.B lzgrep
+.B xzgrep
.RI [ grep_options ]
.RB [ \-e ]
.I pattern
.IR filename ".\|.\|."
.br
+.B xzegrep
+.RB ...
+.br
+.B xzfgrep
+.RB ...
+.br
+.B lzgrep
+.RB ...
+.br
.B lzegrep
.RB ...
.br
.B lzfgrep
.RB ...
.SH DESCRIPTION
-.B lzgrep
+.B xzgrep
is used to invoke the
.BR grep (1)
-on LZMA compressed files. All options specified are passed directly to
+on .xz or .lzma compressed files. All options specified are passed directly to
.BR grep .
If no file is specified, then the standard input is decompressed
if necessary and fed to grep.
@@ -25,37 +35,43 @@ Otherwise the given files are uncompressed if necessary and fed to
.BR grep .
.PP
If
-.B lzgrep
+.B xzgrep
is invoked as
-.B lzegrep
+.B xzegrep
or
-.B lzfgrep
+.B xzfgrep
then
.B egrep
or
.B fgrep
is used instead of
.B grep.
+The same applies to names
+.BR lzgrep ,
+.BR lzegrep ,
+and
+.BR lzfgrep ,
+which are provided for backward compatibility with LZMA Utils.
+
If the GREP environment variable is set,
-.B lzgrep
+.B xzgrep
uses it as the
.B grep
program to be invoked. For example:
- for sh: GREP=fgrep lzgrep string files
- for csh: (setenv GREP fgrep; lzgrep string files)
+ for sh: GREP=fgrep xzgrep string files
+ for csh: (setenv GREP fgrep; xzgrep string files)
.SH AUTHORS
Original
.BR zgrep (1)
manual page by Charles Levert <charles@comm.polymtl.ca>.
.PP
-Minor modifications for LZMA utils by Lasse Collin
+Minor modifications for XZ Utils by Lasse Collin
<lasse.collin@tukaani.org>.
.SH "SEE ALSO"
.BR grep (1),
.BR egrep (1),
.BR fgrep (1),
-.BR lzdiff (1),
-.BR lzmore (1),
-.BR lzma (1),
-.BR lzmash (1)
+.BR xzdiff (1),
+.BR xzmore (1),
+.BR xz (1)