replace-all-string - Replace string with new string in a list of files
n replace-all-string "from" "to" "files" ["grep-from"]
replace-all-string, similar to replace-string(2), replaces all occurrences of "from" to "to" in the given list of files without prompting the user.
The command finds all occurrences of "from" by calling the command grep(3) to search for string "from" in files "files". Thus all relevant edited files must be saved or grep may return the wrong line numbers. This is achieved by a call to save-some-buffers(2) which prompts the user to save any changed buffers one at a time.
Each occurrence of "from" is jumped to using get-next-line(2) and the string is replaced by the call:
-1 replace-string "from" "to"
This replaces all occurrences of "from" to "to" on the current line only, hence the line numbers must be correct. This also means that the "from" search string must be correctly formatted for both grep and replace-string, unless bit 0x02 is set (see below).
The given argument n is a bit based flag which changes the default behavior described above. The bits have the following effect:-
0x01
0x02
replace-all-string is a macro defined in search.emf.
The grep command must be working before this command can function properly.
It is not recommended to use a "from" or "to" string which uses more that one line as the results may be unpredictable.
As the change is likely to be over several files a single call to undo(2) at the end of execution will not undo all the changes made. To undo all the changes made, use get-next-line(2) to loop through all the occurrences and call undo for each occurrence
replace-string(2), save-some-buffers(2), grep(3), get-next-line(2), undo(2), query-replace-all-string(3), replace-all-pairs(3), search-forward(2).
(c) Copyright JASSPA 1999
Last Modified: 1998/09/02
Generated On: 1999/12/01