1
/*---------------------------------------------------------------------------
3
zipgrep.cmd (ye olde REXX procedure for OS/2)
5
Script to search members of a zipfile for a string or regular expression
6
and print the names of any such members (and, optionally, the matching
7
text). The search is case-insensitive by default.
10
original Bourne shell version by Jean-loup Gailly
11
modified by Greg Roelofs for Ultrix (no egrep -i) and zipinfo -1
12
OS/2 REXX script by Greg Roelofs
14
Last modified: 19 Jul 93
16
---------------------------------------------------------------------------*/
18
PARSE ARG string zipfile members
20
if (string == '') then do
21
say 'usage: zipgrep search_string zipfile [members...]'
22
say ' Displays the names of zipfile members containing a given string,'
23
say ' in addition to the matching text. This procedure requires unzip'
24
say ' and egrep in the current path, and it is quite slow....'
28
/* doesn't seem to work...
29
newq = RXQUEUE("Create",zipgrep_pipe)
30
oldq = RXQUEUE("Set",newq)
33
/* flush the queue before starting */
38
/* GRR: can also add "2>&1" before pipe in following external command */
39
'@unzip -Z1' zipfile members '| rxqueue'
43
'@unzip -p' zipfile file '| egrep -is' string
46
/* can comment out following line if just want filenames */
47
'@unzip -p' zipfile file '| egrep -i' string
52
call RXQUEUE "Delete",newq
53
call RXQUEUE "Set",oldq