# p command (Editor processor)

The p command either defines or executes a pre-stored command;
 p by itself assumes p0 (zero).

## Syntax

```
 p{{number}editor.command{[editor.command...}}
```

## Parameter(s)

| number | Defines the pre-stored buffer. |
| --- | --- |
| editor.command | Any valid Editor command. |
| [ | (Control) value mark. |

## Defining pre-stored commands

An Editor command sequence may be assigned to a specified number (in the range 0–9). Each
 pre-stored command may contain up to 100 bytes. When no number is specified, 0 is assumed. The
 Esc key is used as a command delimiter to separate multiple Editor commands. The default
 prestore, p0, is l22, or list 22 lines.

Note: Pre-stored Editor command sequences *must* be redefined each time the Editor is
 initiated.

## Executing pre-stored commands

To execute a pre-stored command, the p command is issued along with the number
 of the command to execute:

```

 p{number}
```
The p command, followed by pressing Enter, executes the command sequence
 stored in p0 (zero). The pd command displays the current
 pre-stored commands. It is recommended to review pre-stored commands after defining them and
 before executing them.

## Example(s)

```

 p1 b[u22[l22
```
Defines pre-stored command p1 with the command sequence:

- Go to the bottom of the item.

- Move the line pointer up 22 lines.

- List 22 lines.

Each time the p1 command is issued, the *last* 22 lines of the item display.

```

 p2 ru9999.abc.xyz[fi[p2
```
Defines pre-stored command p2 as:

- Replace, in the next 9999 lines, all occurrences of abc with xyz.

- File the item.

- Repeat the process on the next item (by calling the p2 command), or, if all items have been processed, the process falls out to TCL.

Note: The `[` displayed in *both* examples is the character echoed to the
 screen when Esc is pressed. This further assumes that the Esc key is *not* currently
 programmed to *push* a level.

## See also

- [esc-data command](https://d3codex.com/tcl/esc-data-command/)
- [esc-level command](https://d3codex.com/tcl/esc-level-command/)
- [pd command](https://d3codex.com/editor/pd-command/)

---
Source: https://d3codex.com/editor/p-command-editor-processor/ - part of the D3Codex reference.
