0x1949 Team - FAZEMRX - MANAGER
Edit File: dfgrep
#!/bin/sh # dgrep -- grep through files belonging to an installed Debian package # Copyright (C) 2001 Matt Zimmerman <mdz@debian.org> # 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, 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. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. set -e prog=`echo $0 | sed 's|.*/d||'` case "$prog" in grep|egrep|fgrep|zgrep|zegrep|zfgrep) ;; *) echo >&2 "dgrep: Unrecognized invocation: $0"; exit 1 ;; esac # Option parser modeled after the one in zgrep from GNU grep recursive=0 opts="" pat="" after_args="" while test $# -ne 0; do case "$1" in --recursive|--d*=recurse) echo >&2 "dgrep: recursive grep not supported" exit 1 ;; --d*=skip) ;; --d*=read) echo >&2 "dgrep: --directories=read not supported"; exit 1 ;; --help) echo "Usage: dgrep [most grep options] <pattern> <package>..."; exit 0 ;; --*) ;; -*) case "$1" in -*r*) echo >&2 "dgrep: recursive grep not supported"; exit 1 ;; esac ;; esac case "$after_args$1" in -[ef]) opts="$opts $1"; shift; pat=$1 ;; -[ABCdm]) opts="$opts $1 $2"; shift ;; --) opts="$opts $1"; after_args=1 ;; -*) opts="$opts $1" ;; *) if test -z "$pat"; then pat=$1 else break fi ;; esac shift done for pkgglob in "$@"; do dglob -0f "$pkgglob"; done | xargs -0r $prog $opts "$pat"