C-PLOT

Scientific Graphics and Data Analysis

shell.4

external-filter user function

SYNOPSIS

fn shell.4 [command]

DESCRIPTION

The function shell.4 runs command in a subprocess as a filter. The current data becomes input to the subprocess, while the output of the subprocess becomes the new data.

With no arguments, you are prompted for a command. Otherwise the command is taken from the command line. If the command is entered as a dot, the previously entered command is used.

Input

The current points are sent to the subprocess with the x and y values on one line, with one line per data point. If the error-bar mode is on, error-bar values also are included on the line. If pen-control mode is on, pen-control values are included as well. If there are no current points, a single newline is written to the command subprocess.

If the subprocess is not interested in the current data, you can save time and system resource by erasing the current data using the gd 15 command.

Output

The output of the subprocess is scanned for data values, with the new number of points determined by the lines of data that are read. If error-bar and/or pen-control modes are in effect, corresponding values also will be scanned. It is not considered an error for either of these values to be missing, but values that are missing from the input are set to 0.

A line read from the subprocess that doesn't contain valid data is simply printed on the terminal.

Execution

The Bourne shell (/bin/sh) is used to invoke the command. Each time shell.4 is invoked, the previous instance of the command is killed. All signals for the subprocess running the command are restored to their default values.

EXAMPLES

Using awk:

fn shell.4 awk '{print $1, 3 * $2}'

This usage multiplies the y values by 3.

Using sort:

fn shell.4 sort -n

This usage sorts the data by x values. (Beware, sort doesn't recognize scientific notation.)

Using zcat:

fn shell.4 zcat data.Z

This usage uncompresses the contents of the file named data.Z on the fly and uses the values contained therein as the new data points.

SEE ALSO

eb fn lc