Finding text, Searching forward through the buffer, Searching backward through the buffer – HP NonStop G-Series User Manual

Page 172

Advertising
background image

-
The only way to stop
-
?

When you try to move beyond the first line in the buffer, you receive the ? message. You cannot
move beyond the top of the buffer.
To move the current line forward through the buffer more than one line at a time, enter .n (where
n

is the number of lines you want to move):

.2
line that contains only

Note that .2 is an abbreviation for .+2.

To move the current line backward through the buffer more than one line at a time, enter: .-n
(where n is the number of lines you want to move):

.-2
The only way to stop

Finding Text

If you do not know the number of the line that contains a particular word or another string of
characters, you can find the line with a context search.
To make a context search, do one of the following:

To search forward, enter:

/string_to_find/

To search backward, enter:

?string_to_find?

Searching Forward Through the Buffer

To search forward through the buffer, enter the string enclosed in // (slashes):

/only/
line that contains only

The context search (/only/) begins on the first line after the current line, then locates and displays
the next line that contains the string “only”. That line becomes the current line.
If ed does not find the string between the first line of the search and the last line of the buffer, then
it continues the search at line 1 and searches to the current line. If ed searches the entire buffer
without finding the string, it displays the ? error message:

/random/
?

Once you have searched for a string, you can search for the same string again by entering just
//

. The following example shows one search for the string “only”, and then a second search for

the same string:

/only/
The only way to stop
//
line that contains only

Searching Backward Through the Buffer

Searching backward through the buffer is much like searching forward, except that you enclose
the string in question marks (??):

?appending?
appending is to type a

172

The ed Editor

Advertising
This manual is related to the following products: