11 Change . . . replace . . . search


Another of those boring and time consuming tasks which seem to attract errors is going through a document to change a word every time it occurs. For example, you may already have typed a letter which sets out an agreement with a Mr Q R Smith, and you now want to send an identical letter to make a similar agreement with a Mr H I Jones. Or maybe you are typing a text about computers in which you have used the spelling 'disk' - only to find that your editor absolutely insists on the spelling 'disc'.

With traditional typing, making a change like this must count as the most boring of all possible jobs, but with word processing it could not be simpler. In the last example all you would do would be to switch to command mode and type:

CHANGE disk disc RETURN

and the word would be changed automatically throughout the whole text. Try a few examples for yourself.

Notice how the CHANGE command copies the case of the word to be changed. So with the command above, for example, 'DISK' would be changed to 'DISC' and 'Disk' into 'Disc'.

Naturally you can use this not only to correct spelling but to change the terminology itself. For example, if you are writing about antiques and mention 'grandfather clocks', you may find your editor insisting that 'long-case clocks' is the correct horological term. No problem:

CHANGE grandfather long-case RETURN

and again 'Grandfather' will become 'Long-case' too.

The way in which VIEW copies the case of the original can be very useful, but it can also prevent you from altering the case if you want to. For example you may be producing a report about an antibiotic called 'erythromycin'. You have nearly finished when you find that this is a proprietary name, and should be written 'Erythromycin'.

To make a correction like this you need to switch off VIEW's facility to copy the case of the original. This facility is known as 'folding', and you can switch it off by using the command FOLD (in command mode) with the number 0 after it:

FOLD 0 RETURN

After this you can issue the instruction:

CHANGE erythromycin Erythromycin RETURN

and the change will be made. To turn folding on again, replace the 0 with a 1 - and if you forget whether folding is on or off, just type

FOLD RETURN

and VIEW will tell you.

11.1 REPLACE


The REPLACE command is used when you want to change some of the words only, and want to make a decision on each one. Suppose you refer to a report in your text, giving the author as 'Green'. You subsequently discover that the author was 'Stephenson', so naturally you use the CHANGE command. To your dismay you later discover that you have also changed 'the green screen' to 'the stephenson screen'.

In cases like this you should use the REPLACE command instead of CHANGE. It allows you to make a separate decision on each occurrence of the word. The command is given in much the same way as CHANGE:

REPLACE Green Stepehnson RETURN

The system switches to text mode and the first occurrence of 'Green' is signalled by the cursor being placed on the first letter. If you do not want that word replaced, press N. If you want it replaced press Y. VIEW then moves on to the next occurrence of the word, until you have made your decision on them all.

Folding works with REPLACE in the same way as it does with CHANGE.

11.2 SEARCH


If you want to find a particular word but do not want to change it, or cannot predict how you will change it until you see it, the most useful command is SEARCH. The command is given in the same way as the commands to change text:

SEARCH Green RETURN

The system changes to text mode and the cursor rests on the first occurrence of the word named. To find the next press NEXT MATCH ( CTRL f1 ).

So what happens when you search for a word which you know is there, but the SEARCH command cannot find it? Perhaps you have mistyped it? - in which case the SEARCH command will never find it. Here again VIEW comes to the rescue with the 'wild search' facility.

All you have to do is to operate the search while substituting a '?' for each character which may be wrong. So if you want to find 'Erythromycin' but are not sure how it is spelt, you will find it quite quickly if you ask for 'Erythro?????'.

With more common words it will of course find other words of similar spelling, but you can quickly move on using NEXT MATCH.

Even RETURN and TAB can be specified in your searches, using the vertical bar and the tilde (~) respectively. Consult the Guide for more detail on this.

11.3 Limited searching and changing


You can cause the commands SEARCH, CHANGE and REPLACE to act on a limited area of the text if you set markers 1 and 2 before and after the text concerned and then name these markers in the command:

CHANGE disk disc 1 2 RETURN

This will change 'disk' to 'disc' between the markers only.

11.4 Finding and changing phrases


The space between the words of a CHANGE command has a definite function: it signals to VIEW that you want the word before the space changed into the word after it. To replace one group of words with another, therefore, requires a slightly different method.

The method is to enclose the phrases within slashes, like this:

CHANGE/Read Only Memory/Random Access Memory/ RETURN

The space or slash in CHANGE and similar commands is known as a 'delimiter' since its function is to show where one thing ends and another begins. The first character after CHANGE indicates to VIEW which delimiter is being used, and it must then be used consistently through the command.