If you think that finding stuff is fun, just wait till you start to do replacements.
This command, [Esc][R], permits you to change one or more occurrences of a pattern with a new one. You will first be asked for a pattern to find (the ``original pattern'') and the pattern to replace it with. Next you will be asked if you wish to replace only the next occurrence of the pattern, all occurrences or if you want to be prompted for each occurrence. If you press [N] only the next occurrence of the pattern will be changed. If you press [A] then all occurrences of the pattern, from the current cursor position, will be changed. If you press [P] then the cursor will be moved to the next occurrence of the pattern, the pattern will be highlighted until you press [Q], [R] [Y] or [N]. [Y] or [R] (yes or replace) will change the pattern and advance the cursor to the next match, [N] (no or next) will not change the pattern; however, the cursor will be advanced to the next occurrence, [Q] (quit) will stop the operation of replace. If you are doing a prompted or global (all) replacement, the number of changes made will be displayed when the end of file is reached and the cursor will return to the position it was when you started the replace. If no matches at all are found, then a ``target not found'' message will be displayed.
You can also terminate a prompted find/replace by pressing the [Ctrl-C] key. In this case the you will skip the ``number of changes made'' prompt and the cursor will remain at the point in the file where the abort was done.
If a block is currently highlighted, replace will function only on the block. This is useful if you only wish to make ``global'' changes to part of a file.
When the case match option is disabled (Section 18.2.1), Ved attempts to keep the case of the replacement the same as the original--but it fails when one string is longer than the other or if non-alpha characters are used.
You can use a wildcard11.1 in both the original pattern and the replacement pattern. A find/replace of:
Original Pattern c?twill make the following changes:
Replacement Pattern d?g
cat dag
cot dog
cut dug
Using a wildcard in a replace string only makes sense if a wildcard is specified in the same position in the find string; however, Ved will accept it in either or both strings in any position(s).
The most likely way wildcards in replace strings will be used is in cases where you are editing a file with line feeds in it and you want to make changes to two-word combinations which may or may not span a line and you wish to keep the original carriage returns.
Pressing [Esc][A] Duplicates the last replace command entered. Note that this includes the mode (N, A or P).