Using system commands from ed, Ending the ed program – HP NonStop G-Series User Manual

Page 180

Advertising
background image

The 1,$p subcommand displays the entire contents of the buffer, showing that ed has made and
inserted the copies and that the original lines are not affected.

Using System Commands from ed

Sometimes you may find it convenient to use a system command without leaving the ed program.
Use the exclamation point (!) character to leave the ed program temporarily.
To use a system command from ed, enter the following:

!command

In the following example, the !ls command temporarily suspends the ed program and runs the
ls

(list) system command:

!ls
afile
bfile
cfile
!

The ls command displays the names of the files in the current directory (afile, bfile, and
cfile

), and then displays another ! character. The ls command is finished, and you can continue

to use ed.
You can use any system command from within the ed program. You can even run another ed
program, edit a file, and then return to the original ed program. From the second ed program,
you can run a third ed program, use a system command, and so forth.

Ending the ed Program

To save your file and end the ed program, do the following steps:
1.

Enter the following to save your file:

w

2.

Enter the following to exit ed:

q

For a full discussion of the w and q subcommands, see

“Saving Text—The w (Write) Subcommand”

(page 167)

and

“Ending the ed Program—The q (Quit) Subcommand” (page 168)

, respectively.

For information about other features of ed, see the ed(1) reference page either online or in the
Open System Services Shell and Utilities Reference Manual. For information about printing the files
you create with ed, see

Chapter 8 (page 93)

.

180 The ed Editor

Advertising
This manual is related to the following products: