home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / epmsmp.zip / GREP.E < prev    next >
Text File  |  1996-05-03  |  774b  |  25 lines

  1. ; Call an external GREP utility and display the results in an EPM file.
  2. ; The modified Alt+1 definition in ALT_1.E will let you place the
  3. ; cursor on a line in the results file and press Alt+1 to load the
  4. ; corresponding source file.
  5.  
  6. ; by Larry Margolis
  7.  
  8. defc scan, grep =
  9.    sayerror 'Scanning files...'
  10.    call redirect('grep','/y /q /l' arg(1))
  11.    if .last=0 then
  12.       'q'
  13.       sayerror 'No hits.'
  14.    endif
  15.  
  16. defproc redirect(cmd)
  17.    universal vTEMP_PATH
  18.    outfile=vTEMP_PATH || substr(cmd'_______',1,8) || '.out'
  19.    quietshell cmd arg(2) '>'outfile '2>&1'
  20.    if RC = sayerror('Insufficient memory') or
  21.       RC = sayerror('File Not found')      then stop; endif
  22.    'e' outfile
  23.    .filename='.Output from' cmd arg(2)
  24.    call erasetemp(outfile)
  25.