16.12.2012 Views

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

|<br />

Subcommands<br />

An ed command has the form [address] command<br />

All commands end with a newline; you must press . Most commands allow<br />

only one command on a line, although you can modify commands by appending the<br />

l, n, and p commands.<br />

Subcommands generally take a maximum of zero, one, or two addresses,<br />

depending upon the particular subcommand. In the following descriptions, we show<br />

commands with their default addresses (that is the addresses used when you don’t<br />

specify any addresses) in a form that shows the maximum number of permitted<br />

addresses for the command. In any of the subcommands that take a file argument,<br />

file can be a pathname or:<br />

!command-line<br />

If you use the ! form, ed runs the given command line, reading its standard output<br />

(stdout) or writing its standard input (stdin), depending on whether the ed<br />

command does reading or writing.<br />

If a terminal disconnect is detected:<br />

v If the buffer is not empty and has changed since the last write, the ed utility will<br />

attempt to write a copy of the buffer to a file named ed.hup in the current<br />

directory. If this write fails, ed will attempt to write a copy of the buffer to a<br />

filename ed.hup in the directory named by the HOME environment variable. If<br />

both these attempts fail, ed will exit without saving the buffer.<br />

v The ed utility will not write the file to the currently remembered pathname or<br />

return to command mode, and will terminate with the exit status of 1.<br />

If an end-of-file is detected on standard input:<br />

v If the ed utility is in input mode, ed will terminate input mode and return to<br />

command mode. Any partially entered lines (that is, input text without a<br />

terminating newline) will be saved.<br />

v If the ed utility is in command mode, it will act as if a q command had been<br />

entered.<br />

ed accepts the following subcommands:<br />

.a Appends text after the specified line. Valid addresses range from 0 (text is<br />

placed at the beginning of the buffer, before the first line) to $ (text is placed<br />

after the last line of the buffer). ed reads lines of text from the workstation<br />

until a line consisting solely of an unescaped . (dot) is entered. ed sets the<br />

current-line indicator to the last line appended.<br />

.,.c Changes the addressed range of lines by deleting the lines and then<br />

reading new text in the manner of the a or i subcommands. If the variable<br />

_<strong>UNIX</strong>03 is set to YES, address 0 is valid for this subcommand and it will<br />

be interpreted as if address 1 were specified.<br />

.,.d Deletes the addressed range of lines. The line after the last line deleted<br />

becomes the new current line. If you delete the last line of the buffer, ed<br />

sets the current line to the new last line. If no lines remain in the buffer, it<br />

sets the current line to 0.<br />

E[file] Is similar to the e command, but ed gives no warning if you have changed<br />

the buffer.<br />

e [file] Replaces the contents of the current buffer with the contents of file. If you<br />

ed<br />

Chapter 2. Shell command descriptions 249

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!