Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
zipgrep
Package: unzip540.zip [view]
Upload User: andy_li
Upload Date: 2007-01-06
Package Size: 1019k
Code Size: 1k
Category:
Compress-Decompress algrithms
Development Platform:
MultiPlatform
- #! /bin/sh
- # zipgrep: searches the given zip members for a string or pattern
- # This shell script assumes that you have installed UnZip.
- pat=""
- opt=""
- while test $# -ne 0; do
- case "$1" in
- -e | -f) opt="$opt $1"; shift; pat="$1";;
- -*) opt="$opt $1";;
- *) if test -z "$pat"; then
- pat="$1"
- else
- break;
- fi;;
- esac
- shift
- done
- if test $# = 0; then
- echo "usage: `basename $0` [egrep_options] pattern zipfile [members...]"
- echo searches the given zip members for a string or pattern
- exit 1
- fi
- zipfile="$1"; shift
- list=0
- silent=0
- opt=`echo "$opt" | sed -e 's/ //g' -e 's/-//g'`
- case "$opt" in
- *l*) list=1; opt=`echo $opt | sed s/l//`
- esac
- case "$opt" in
- *h*) silent=1
- esac
- if test -n "$opt"; then
- opt="-$opt"
- fi
- res=0
- for i in `unzip -Z1 "$zipfile" ${1+"$@"}`; do
- if test $list -eq 1; then
- unzip -p-L "$zipfile" "$i" | egrep $opt "$pat" > /dev/null && echo $i
- r=$?
- elif test $silent -eq 1; then
- unzip -p-L "$zipfile" "$i" | egrep $opt "$pat"
- r=$?
- else
- unzip -p-L "$zipfile" "$i" | egrep $opt "$pat" | sed "s|^|${i}:|"
- r=$?
- fi
- test "$r" -ne 0 && res="$r"
- done
- exit $res