LinuxCommandLibrary

vipe

Edit piped data with a text editor

TLDR

Edit the output of command1 before piping it into command2

$ [command1] | vipe | [command2]
copy

Buffer the output of command1 in a temporary file with the specified file extension in order to aid syntax highlighting
$ [command1] | vipe --suffix [json] | [command2]
copy

Use the specified text editor
$ [command1] | EDITOR=[vim] vipe | [command2]
copy

SYNOPSIS

command ... | vipe | another_command ...

Less commonly: vipe [options] [command]

The most common usage is within a pipeline, where vipe acts as an interactive filter for piped data.

PARAMETERS

-h, --help
    Display a help message and exit.

-v, --version
    Show version information and exit.

DESCRIPTION

vipe is a utility that allows you to edit the data flowing through a Unix pipeline using your preferred text editor. Instead of directly piping the output of one command to another, you can insert vipe in between. vipe captures the input, opens it in an editor (usually determined by the EDITOR or VISUAL environment variables), waits for you to make changes and save, and then sends the modified content to its standard output. This is particularly useful for ad-hoc data manipulation, filtering, or reformatting before passing it to a subsequent command. It provides an interactive step in an otherwise non-interactive pipeline.

For example, ls | vipe | grep ".txt" would let you edit the ls output before it's filtered by grep.

CAVEATS

vipe is not part of the standard GNU Core Utilities and might not be available on all systems by default; it's typically provided by the moreutils package.

It relies on the EDITOR or VISUAL environment variables to determine which editor to launch. If these are not set, it usually defaults to vi or nano.

It creates a temporary file to store the data while editing, which is then deleted upon completion. This makes it less suitable for very large data streams due to potential disk I/O and editor memory limits.

HOW IT WORKS

vipe operates by reading all data from its standard input into a temporary file. It then launches the editor (specified by EDITOR or VISUAL) to open this temporary file. Once the user saves and exits the editor, vipe reads the (potentially modified) content of the temporary file and writes it to its standard output, finally deleting the temporary file.

ENVIRONMENT VARIABLES

The behavior of vipe is heavily influenced by the EDITOR and VISUAL environment variables. If VISUAL is set, it takes precedence over EDITOR. If neither is set, vipe will typically fall back to a default editor like vi or nano, depending on the system configuration and its own internal defaults.

HISTORY

vipe is part of the moreutils package, a collection of small, useful, and commonly desired Unix utilities that are not part of the traditional Core Utilities. It was created to fill common gaps in pipeline functionality, providing an interactive "pipe editor" for on-the-fly data manipulation.

SEE ALSO

sponge(1), more(1), less(1), vi(1), nano(1), EDITOR(7), VISUAL(7)

Copied to clipboard