NAME

bpmanip - Include or exclude fields from bpipe file

SYNOPSIS

bpmanip [-i input_file] [-v fields_to_exclude] [fields_to_include] > output_file

DESCRIPTION

bpmanip reads in an existing bp file and includes or exclude data fields in the output, depending on the user input. File can either be read from STDIN or from existing files with the -i flag. bpmanip's operations are deliberately similar to that of the rdb tool column, although it doesn't support regexes yet.

Data fields are included in the output by specifying them on the command line. For example, if input.bp is a bp file that has three data fields, "weight", "position", and "direction", the following would produce an output.bp file with only one data field, "position". The values in that data field would be unchanged:

bpmanip -i input.bp position >! output.bp

If -i is not specified, STDIN is read from, but the command syntax is otherwise identical, and produces the same effect:

cat input.bp | bpmanip weight >! output.bp

To remove only a certain set of fields, specify them after using the -v flag:

bpmanip -i input.bp -v stuff weight >! output.bp

This will produce an output.bp with all fields except "stuff" and "weight".

Finally, an echo to STDERR of the user input and a running count of how many packets have been processed is available by turning verbosity on with the -w switch:

bpmanip -w -i input.bp -v stuff >! output.bp

will produce output to the screen like this:

        args:   -w      -i      input.bp        -v      stuff
        ----------------------

        input mmap [exclude] = stuff
        program name = bpmanip

        infile   = input.bp

        Writing packets 1 to 10 ... Done

EXAMPLES

    The following examples will assume a bp event list "input.bp",
    containing 10 data packets, each with the following fields:

        direction[1]
        graze_angle[1]
        polarization[4]
        position[1]
        stuff[3][3][3]
        weight[1]

    with a typical packet looking something like:

        data packet 1:
        direction[1]: : 2       2       2
        graze_angle[1]: : 1
        polarization[4]: : 0 | 1 | 2 | 3
        position[1]: : 0        0       0
        stuff[3][3][3]: [0][0]: 42 | 42 | 42
        stuff[3][3][3]: [0][1]: 42 | 42 | 42
        stuff[3][3][3]: [0][2]: 42 | 42 | 42
        --------------------
        stuff[3][3][3]: [1][0]: 42 | 42 | 42
        stuff[3][3][3]: [1][1]: 42 | 42 | 42
        stuff[3][3][3]: [1][2]: 42 | 42 | 42
        --------------------
        stuff[3][3][3]: [2][0]: 42 | 42 | 42
        stuff[3][3][3]: [2][1]: 42 | 42 | 42
        stuff[3][3][3]: [2][2]: 42 | 42 | 42
        --------------------
        weight[1]: : 235.3
Include mode:

bpmanip -i input.bp weight >! output.bp

        will produce an output.bp
        containing only the weight field.

cat input.bp | bpmanip weight >! output.bp

        will produce identical output.
Using the exclude (-v) mode:

bpmanip -i input.bp -v stuff weight >! output.bp

        produces an output.bp file with
        everything but the stuff and weight
        fields in the data packets.
If fields to include and exclude are specified, excludes trump includes:

bpmanip -i input.bp weight stuff -v stuff | bpipe_dump

        produces a bp stream (in the instance,
        we aren't writing to file) with just a
        "weight" field ("weight" and "stuff"
        were included, and then "stuff" was excluded,
        leaving only "weight").

        Excluding and including the exact same
        list of fields will produce a helpful
        error (and cause the program to exit
        gracefully without producing any input).
Finally, running with the -w flag prints output to the screen (via STDERR) about the user input and the current packet being processed, as shown above.

bpmanip -w -i input.bp -v stuff >! output.bp

LICENSE

This software is released under the GNU General Public License. You may find a copy at

   http://www.fsf.org/copyleft/gpl.html

VERSION

$Revision$

AUTHOR

    Kester (Christopher) Allen ( callen@cfa.harvard.edu )