3.3

Table Of Contents
Starting ed
295
Searching Tips
Here are a few more tips for searching with ed.
Remember to use spaces before and/or after text to further define your search string. For
instance, type
/ 25 /
instead of
/25/
to avoid finding other numbers that contain the
number 25, such as in the line:
server 251 action 251 - ;timed action
Remember that searches are case sensitive. For instance, searching for /MONITOR/
does not find monitor.
Remember that searches distinguish between spaces and tabs. In other words, if you use
spaces and the file contains the information separated by a tab, you will not find it. For
instance, the search example below will not work:
You type:
/monitor 271/
(monitor and 271 are separated by a space)
The line is:
server 271 monitor 271 - ;Morning Show
(monitor and 271 are
separated by a tab)
Editing Commands
There are several basic editing commands you can use in ed to view, change, add, move, and
delete text in a system file.
n
Some commands, such as Add, Delete, and Insert, change the current line, while others do
not. For instance, the Print command sets the current line to the number of the last line
printed.
Here is a list of editing commands, along with examples of their use:
Command Description & Examples
a
The Append command inserts one or more lines after the selected line. For
instance:
/websession/
;websession 900
a
inws 511 - gnews - ;
inws
.
In the above example, the user searches for websession, and ed responds by
displaying the first line found containing that word. The user types a, presses
Enter to start the append operation, and types information to be inserted in the
file after the displayed line. The user then types a period (.) on a line by itself,
which is very important because it terminates the append operation. Without it,
successive lines typed by the user would be added to the file.