--- Dave Waroff <[log in to unmask]> wrote:
> The invocation of the shell should be required to expand the filename
> specification, which has a wildcard in it. Traditionally grep does
> not do wildcard expansion (except with the -r option)
i love eatting my words <sigh>
all this got me to wondering just how it was that my 'grep' script was
working.... lo and behold, it works on an individual file and only
provides the allusion of expanding a file set. a file set may be
expressed as [log in to unmask] or [log in to unmask] since this is an
mpe script, you do want to use '@' and not '*'. - d
-----------------
parm file_set="", search_string="", entry_point="main"
if "!entry_point" = "main"
if "!file_set" = "?"
echo
echo ![basename(hpfile)] [file set],[search string]
echo This command uses grep to search a fileset for all occurances
echo of a given string
echo [file set] may be expressed in traditional mpe or posix
echo notation
echo [search string] what is being searched for. Capitalization
echo is not important.
echo
else
file allfiles;disc=50000;temp
if finfo("*allfiles","exists")
purge allfiles,temp
endif
errclear
continue
listfile !file_set,6 >*allfiles
if hpcierr = 0
!hpfile not_needed, !search_string, print < allfiles
else
echo
echo ERROR: listfile,6 failed for !file_set
echo CIError: !hpcierr,!hpcierrmsg
echo
endif
reset allfiles
purge allfiles,temp
deletevar _g_@
endif
else
setvar _g_allfiles_eof finfo("*allfiles","eof")
while setvar(_g_allfiles_eof,_g_allfiles_eof-1) >= 0
input _g_file_name
echo ==========================
echo !_g_file_name
echo --------------------------
errclear
setvar _g_grep_ok true
if pos("MSG",setvar(_g_fopts,finfo(_g_file_name,"fmtfopt"))) > 0
echo ... is a msg file, skipping grep
setvar _g_grep_ok false
elseif pos("BINARY",_g_fopts) > 0
echo ... is a binary file, skipping grep
setvar _g_grep_ok false
elseif pos("ASCII",_g_fopts) = 0
echo ... is not an ASCII file, skipping grep (!_g_fopts)
setvar _g_grep_ok false
endif
if pos("SYMLINK",(finfo(_g_file_name,"filetype"))) > 0
echo ... is a symbolic link, skipping grep
setvar _g_grep_ok false
endif
if _g_grep_ok
grep.hpbin.sys "-i '!search_string'" < !_g_file_name
endif
endwhile
endif
Donna Garverick, HP-CSA Sr. System Programmer
dgarverick -at- longs -dot- com
925-210-6631 Longs Drug Stores
Come, my friends, 'Tis not too late to seek a newer world.
Tho' much is taken, much abides; and tho'
We are not now that strength which in old days
Moved earth and heaven, that which we are, we are.
"Ulysses", A. Tennyson
>>>MY opinions, not Longs Drug Stores'<<<
__________________________________
Discover Yahoo!
Use Yahoo! to plan a weekend, have fun online and more. Check it out!
http://discover.yahoo.com/
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|