Name

h

Synopsis

[address1[,address2]]h

Description

Copy the pattern space into the hold space, a special temporary buffer. The previous contents of the hold space are obliterated. You can use h to save a line before editing it.

Example

                     # Edit a line; print the change; replay the original
/Linux/{
h
s/.* Linux \(.*\) .*/\1:/
p
x
}

Sample input:

                     This describes the Linux ls command.
This describes the Linux cp command.

Sample output:

ls:
This describes the Linux ls command.
cp:
This describes the Linux cp command.

Get Linux in a Nutshell, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.