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:-
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
Copyright (c) 1998-2006 JASSPA
Last Modified: 2002/01/11
Generated On: 2006/10/07