* Search/Replace v1.0a * SRCH10.QM * SRCH10 are QEdit macros to search/replace only files containing * search text. First, a filelist of files containing the search text is * made. These files are then loaded automatically and the desired * search/replace is performed. Only files containing the desired * search/replace text are changed. * Macros Included: * * @1 - Makes filelist of files containing expression * @2 - Loads filelist of files containing expression * @3 - Search/replace loaded files * @4 - Loads filelist of files containing expression, then * search/replace loaded files, SINGLE word text only. * @5 - Same as @4 but does not use SRCH.BAT, use @5 for * search/replace of SINGLE or MULTIPLE word text. * To Run: * * In order for these macros to run, you first need to make a filelist, * SRCH-FG.LST, of the files to be searched. Here's mine: * * *.qm * *.ql * *.lst * *.inf * *.bat * * This list may include [drive]:\[directory] and should be located in * the current directory where the search begins. If the list is to be * located in a directory other than the current directory, replace: * * "@SRCH-FG.LST" * * in SRCH.BAT with * * @[drive]:\[directory]\[filename] * * Chris Dunford's excellent FGREP must be located in the path. * * Replacing C: with your ram disk will make the macros run faster. * * Use @1 & @4 for search/replace of SINGLE word text only. * Use @5 for search/replace of SINGLE or MULTIPLE word text. * Version History: * * 1.0a - corrected @5 to use @SRCH-FG.lst, not SRCH.lst. *旼컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴� *� @1 - makes filelist of files containing expression � *읕컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴� @1 MacroBegin Dos "SRCH " Pause * make filelist return return * editfile "c:SRCH.ql" return quit* edit filelist editfile return * begfile * MarkColumn * mark begfile c:SRCH.ql endfile begline * mark endfile col 1 wordright wordright * get to filename cursorleft * move off filename DeleteBlock * delete **File in fgrep output SaveFile * save filelist begfile * get to begin MarkColumn * mark begfile c:figs.ql EndFile * get to end gotocolumn "12" return * get all filenames in block Sort * sort filelist begfile * see filelist unmarkblock * without block mark * * 62 bytes Sun 08-26-1990 23:03:55 *旼컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴커 *� @2 - loads filelist of files containing expression � *읕컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴켸 @2 MacroBegin ***************************************** LOAD FILELIST (from QLIST10) EndFile BegLine * start at last line REPEAT: UnmarkBlock MarkLine Copy * grab this name EditFile * get ready to load CurrentFilename " " * to force return *here* Paste Return * paste filename & do it! CursorUp * more lines above? JTrue REPEAT: * if yes, repeat. * * 19 bytes Sun 08-26-1990 23:04:06 *旼컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴� *� @3 - search/replace loaded files � *읕컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴� * Written by Kyle Watkins, SemWare. * @3 MacroBegin FindReplace Pause Return * Ask for the find text Pause Return * Ask for the replacement text Pause EndLine "GN" Return * Make sure no stop, and execute. FILE * Save this FILE to disk & go to next AGAIN: RepeatFind FILE * Repeat change & Save. Keep going. JTrue AGAIN * This jump is actually an "infinite * loop". The fact that FILE will * terminate the editor breaks the loop * * 22 bytes Sun 08-26-1990 23:04:43 *旼컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴커 *� @4 - loads filelist of files containing expression, � *� then search/replace loaded files � *읕컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴켸 @4 MacroBegin Dos "SRCH " Pause * make filelist return return * editfile "c:SRCH.ql" return quit* edit filelist editfile return * begfile * MarkColumn * mark begfile c:SRCH.ql endfile begline * mark endfile col 1 wordright wordright * get to filename cursorleft * move off filename DeleteBlock * delete **File in fgrep output SaveFile * save filelist begfile * get to begin MarkColumn * mark begfile c:figs.ql EndFile * get to end gotocolumn "12" return * get all filenames in block Sort * sort filelist ***************************************** LOAD FILELIST (from QLIST10) EndFile BegLine * start at last line REPEAT: UnmarkBlock MarkLine Copy * grab this name EditFile * get ready to load CurrentFilename " " * to force return *here* Paste Return * paste filename & do it! CursorUp * more lines above? JTrue REPEAT: * if yes, repeat. ***************************************** FIND/REPLACE FindReplace Pause Return * Ask for the find text Pause Return * Ask for the replacement text Pause EndLine "GN" Return * Make sure no stop, and execute. FILE * Save this FILE to disk & go to next AGAIN: RepeatFind FILE * Repeat change & Save. Keep going. JTrue AGAIN * This jump is actually an "infinite * loop". The fact that FILE will * terminate the editor breaks the loop * * 93 bytes Sun 08-26-1990 23:04:57 *旼컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴커 *� @5 - same as @4 but does not use SRCH.BAT � *읕컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴켸 * Use @5 for search/replace of multiple word text * @5 MacroBegin Dos 'FGREP -F0 "' * make filelist Pause * '">c:SRCH.ql @SRCH-FG.lst' *<-- corrected v1.0a return return * editfile "c:SRCH.ql" return quit* edit filelist editfile return * begfile * MarkColumn * mark begfile c:SRCH.ql endfile begline * mark endfile col 1 wordright wordright * get to filename cursorleft * move off filename DeleteBlock * delete **File in fgrep output SaveFile * save filelist begfile * get to begin MarkColumn * mark begfile c:figs.ql EndFile * get to end gotocolumn "12" return * get all filenames in block Sort * sort filelist ***************************************** LOAD FILELIST (from QLIST10) EndFile BegLine * start at last line REPEAT: UnmarkBlock MarkLine Copy * grab this name EditFile * get ready to load CurrentFilename " " * to force return *here* Paste Return * paste filename & do it! CursorUp * more lines above? JTrue REPEAT: * if yes, repeat. ***************************************** FIND/REPLACE FindReplace Pause Return * Ask for the find text Pause Return * Ask for the replacement text Pause EndLine "GN" Return * Make sure no stop, and execute. FILE * Save this FILE to disk & go to next AGAIN: RepeatFind FILE * Repeat change & Save. Keep going. JTrue AGAIN * This jump is actually an "infinite * loop". The fact that FILE will * terminate the editor breaks the loop * * 147 bytes Sun 08-26-1990 23:05:09 * 153 bytes Mon 08-27-1990 01:01:10 corrected to @SRCH-FG.lst * Tom Hogshead Mon 08-27-1990 01:08:31