home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Der Mediaplex Sampler - Die 6 von Plex
/
6_v_plex.zip
/
6_v_plex
/
DISK5
/
DOS_34
/
AMAC44.ZIP
/
SRQ.BAT
< prev
next >
Wrap
DOS Batch File
|
1992-06-22
|
4KB
|
96 lines
: SRQ.BAT Search/Replace, Can Remove Text From Files, 6/1/92
: QUITS files after replacement
:1) SYNTAX: SRQ.BAT %1 %2 %3
: ┌──────────┘ │ └───────────┐
: (Mode) %1 %2 %3
: Search Text Replace Text File Name/List
: ---------------- ------------- ------------ --------------
: a) Query [ ] [ ] [ ]
: b) Partial Query Search Text [ ] [ ]
: c) Partial Query Search Text [ ] File Name/List
: d) Command line Search Text Replace Text [ ]
: e) All command line Search Text Replace Text File Name/List
:
: where: %1 - Search Text
: %2 - Replace Text
: %3 - File Name or [@File_List], default SRCH-FG.LST
: [ ] - entered at query prompt
:2) Requires FGREP.COM, INPUT.COM and SRQ.MAC
:3) Uses File_List %FileList% if no File Name is specified during input.
: Specify File Name list as [@FileList] to use an alternate File_List,
: or specify File Name, wild cards removes search text.
:4) FGREP options──CANNOT──be changed from default "fl"
:5) set environment variable OPT=off to bypass File Name query prompt
: and use %FileList%. set OPT= to *not* bypass File Name query prompt.
:
:
:
:*******************************************************************************
:* *
:* Environment Variable Action *
:* --------------------------- ----------------------------------------------- *
:* set opt= does not bypass File Name query prompt *
:* set opt=off bypasses File Name query prompt *
:* set filelist= uses sm.lst for testing this batch file *
:* set filelist=srch-fg.lst searches with standard file list srch-fg.lst *
:* set filelist=c:\srch-fg.lst searches with standard file list c:\srch-fg.lst *
:* set srmac= macro files are located in current directory *
:* set srmac=c:\ macro files are located in c:\ directory *
:* *
:*******************************************************************************
:
@echo off
cls
echo SRQ.BAT, June 1, 1992
set S~~=%1
set R~~=%2
set file=%3
if "%filelist%" == "" set filelist=sm.lst
if not "%1" == "" if not "%2" == "" goto 2b
if not "%1" == "" goto 1a
IF "%1" == "" echo Search Text: [Enter terminates batch file]
INPUT.COM Search Text=/b
if errorlevel=1 goto 6a
set s~~=%ans%
goto 2a
:1a
echo Search Text=%S~~%
:2a
set ans=
if "%2" == "" echo Replace Text: [Enter removes search text]
INPUT.COM Replace Text=/b
: if errorlevel=1 goto 6a, removed from SRQ.bat, June 1, 1992 *|
set R~~=%ans%
:2b
set ans=
if not "%opt%" == "" goto 2c
if not "%3" == "" goto 2c
echo File Name(s): [Enter=%FileList%] [File Name(s)] [@FileList]
INPUT.COM File List=/b
set file=%ans%
:2c
if "%file%" == "@" set file=@%filelist%
if "%file%" == "" set file=@%filelist%
:4a
CLS
echo SRQ.BAT, June 1, 1992
echo Search Text = %S~~%
echo Replace Text = %R~~%
echo File Name = %file%
break on
FGREP.COM -fl /%S~~%/ %file% >c:\$.ql
break off
set >c:\$
copy c:\$.ql c:\!
Q.EXE c:\! /E%srmac%SRQ.MAC
goto 7a
:6a
echo.
echo Search/Replace──INCOMPLETE──
goto 8a
:7a
echo.
echo Search/Replace──Complete──
:8a
echo.