Special characters

The above conventions still have one great defect: one cannot search for a character like `/' as it is part of the syntax. For this purpose, an `escape sequence' has been defined. This escape sequence is initiated by the escape (<Esc>) key which enters an escape character into the command line. After the escape character is entered, the next character typed will be put into the command line no matter what it may be (even if it is a backspace). When the command is interpreted (parsed), such a sequence of escape followed by any character is treated separately if the character that follows has a special meaning to stedi . If it doesn't then the ASCII code of this second character will replace the two characters and stedi goes on reading the next character in the command string. In this way, one can search for characters such as backspaces in binary texts. The relevant escape sequences that are initiated via an escape character are:

<Esc>/

Insert a slash (/) in the search or replacement string.

<Esc><Esc>

Put an escape character in the search or replacement string.

<Esc><Return>

Put the ASCII code for a carriage return in the string. This search will have no effect unless there are such characters in the text. This can be the case in a binary file. If the end of line should be matched one should study the chapter on regular expressions which describes searching with patterns, rather than fixed strings.

In most of the above `escape' sequences one could also use the character \ instead of the <escape> key. This makes the typing of a backspace or a return harder, but the typing of the / into the text conforms more to the UNIX standards this way. So searching for the string `10/13' can be done in one othe following ways:

    /10<escape>/13
    /10<escape>/13/
    /10<escape>/13/options
    /10\/13
    /10\/13/
    /10\/13/options

There is also another way to put characters like a backspace into the command line via the hex mode (entered with Ctrl-H p. [*]) which allows for the insertion of any hex ASCII character. There is a subtle difference between the codes entered with the escape sequence and those entered using the Hex mode. With Ctrl-H, any character can be entered from the keyboard into a string, including a return or a slash (/). However in this case, the characters are inserted before the command is interpreted. Thus any slash entered with Ctrl-H will not differ from a normal slash entered from the keyboard and thus will be seen as belonging to the syntax of the search and replace statement. Likewise, a return will be inserted as a `normal' character that has no special status. This is well suited for binary files but is rarely useful for normal text files.



Subsections