home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / epm603a.zip / EPMSMP.ZIP / GREP.E < prev    next >
Text File  |  1992-08-26  |  609b  |  22 lines

  1. ; Call an external GREP utility and display the results in an EPM file.
  2.  
  3. ; by Larry Margolis
  4.  
  5. defc scan, grep =
  6.    sayerror 'Scanning files...'
  7.    call redirect('grep','/y /q /l' arg(1))
  8.    if .last=0 then
  9.       'q'
  10.       sayerror 'No hits.'
  11.    endif
  12.  
  13. defproc redirect(cmd)
  14.    universal vTEMP_PATH
  15.    outfile=vTEMP_PATH || substr(cmd'_______',1,8) || '.out'
  16.    quietshell cmd arg(2) '>'outfile '2>&1'
  17.    if RC = sayerror('Insufficient memory') or
  18.       RC = sayerror('File Not found')      then stop; endif
  19.    'e' outfile
  20.    .filename='.Output from' cmd arg(2)
  21.    call erasetemp(outfile)
  22.