3.3

Table Of Contents
F The Line Editor, ed
294
Searching the File
When you do not know the line number, but you want to locate a line containing a specific
word, phrase, or number, you can use the search option. The line editor, ed, will search the
file, starting at the current line, and display the line with the next occurrence of the specified
text.
To search for text:
1. Type a forward slash (/). Do not press the spacebar.
2. Type the text you want to locate, followed by another forward slash.
3. Press Enter.
For instance, if you want to find websession in the configuration file, type:
/websession/
;websession 900
In the previous example, ed found the word, websession, on line 900. If you want to
repeat the search to locate further occurrences of that word, type a forward slash and
press Enter again. For instance:
/websession/
;websession 900
/
;websession 901
/
;websession 903
In the previous example, the user repeated the original search command two more times.
Each time, ed responded with the word searched and the line number where the next
occurrence of the word appears. In each case, the current line becomes the line number
displayed by ed.