Name

h

Synopsis

[address1[,address2]]h

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
    /Unix/{
    h
    s/.* Unix \(.*\) .*/\1:/
    p
    x
    }

Sample input:

    This describes the Unix ls command.
    This describes the Unix cp command.

Sample output:

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

Get Unix in a Nutshell, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.