| Command | Description |
|---|---|
| b label |
|
| d | Clear the contents of pattern space and start a new cycle. |
| D | Delete the first line from pattern space. Control then passes to the top of the script. If command 'D' empties the pattern space, a new line will be read in; otherwise, no new line will be read in. |
| g | Overwrite the contents of pattern space with hold space. |
| G | Append the contents of hold space to pattern space, separate them by a newline character. |
| h | Overwrite the contents of hold space with pattern space. |
| H | Append the contents of pattern space to hold space, separate them by a newline character. |
|
i\ TEXT | Print TEXT immediately, where TEXT may consists of several lines. In this case, each but the last one of TEXT must be ended with a backslash ('\') followed immediately by a newline character. |
| n | Print the contents of pattern space and overwrite it with next line. Control passes to the command following this 'n'. |
| N | Append next line to pattern space. Next line is separated from the original pattern space by a newline character. |
| p | Print the contents of pattern space. |
| P | Print the first line of pattern space. |
| q | Print the contents of pattern space then exit. |
| r | Copy the contents of the specified file to STDOUT. The contents of that file will not be shown immediately until the end of the script is reached, or command N/n is executed. |
| s/RE/Str/F |
Replace the First string of the line matched RE with
Str.
Where F may be empty or consisting of the following flags:
|
| t |
|
| w | Write the contents of pattern space to the file specified after the w command. |
| x | Exchange the contents of pattern space and hold space. |