home *** CD-ROM | disk | FTP | other *** search
- .K FROM,SEARCH/A,ALL/S,>/K
- .BRA {
- .KET }
- ;; SCH -- A SEARCH Surrogate, that's about twice as fast as
- ;; the AmigaDOS command or more (on long files only, of course
- ;; -- the directory searching part is disk limited).
-
- if "{ALL}" eq "" ;; don't search multiple directory levels
- if "{>}" eq "" ;; no redirection wanted
- MAT S {SEARCH} nocase tag ^P..^|^P.. T " ^N ^O" {FROM}
- else ;; redirect output to desired file
- MAT >{>} S {SEARCH} nocase tag ^P..^|^P.. T " ^N ^O" {FROM}
- endif
- ;; Mat command line arguments:
- ;; S {SEARCH} -- search for the supplied parameter as a string
- ;; nocase -- ignore case in the match
- ;; tag ^P..^|^P.. -- output "<pathname>..." before each file
- ;; tag has the same success and fail parts.
- ;; T " ^N ^O" -- template specifies output format as:
- ;; "<line-number> <original-line>".
- ;; {FROM} -- file spec to search
- ;;
- else ;; ALL specified
- ;; -- the Mat commands below are similar to the above, except that
- ;; multiple directory level file specs are supplied.
- ;; check the spec to see if it is a device, parent, or null:
- MAT #?:|/|% key {FROM}
- ;; -- returns WARN of not (no match between pattern and key argument)
- if WARN ;; -- insert a "/" after parameter
- if "{>}" eq ""
- MAT S {SEARCH} nocase tag ^P..^|^P.. T " ^N ^O" {FROM}/#? {FROM}/#?/#? {FROM}/#?/#?/#? {FROM}/#?/#?/#?/#? {FROM}/#?/#?/#?/#?/#?
- else
- MAT >{>} S {SEARCH} nocase tag ^P..^|^P.. T " ^N ^O" {FROM}/#?/#? {FROM}/#?/#?/#? {FROM}/#?/#?/#?/#? {FROM}/#?/#?/#?/#?/#?
- endif
- else ;; -- use parameter without adding "/"
- if "{>}" eq ""
- MAT S {SEARCH} nocase tag ^P..^|^P.. T " ^N ^O" {FROM}#? {FROM}#?/#? {FROM}#?/#?/#? {FROM}#?/#?/#?/#? {FROM}#?/#?/#?/#?/#?
- else
- MAT >{>} S {SEARCH} nocase tag ^P..^|^P.. T " ^N ^O" {FROM}#? {FROM}#?/#? {FROM}#?/#?/#? {FROM}#?/#?/#?/#? {FROM}#?/#?/#?/#?/#?
- endif
- endif
- endif
-
-