CHOOSE(1)

NAME
choose - human-friendly and fast alternative to cut and awk

SYNOPSIS
choose [FLAGS] [OPTIONS] <choices>...

DESCRIPTION
choose is a terse field selection tool similar to Python's list slices. It is not meant to be a drop-in replacement for awk or cut, but rather a simple and intuitive tool to reach for when the basics of awk or cut will do, but the overhead of getting them to behave should not be necessary.

It features a simple syntax, negative indexing from the end of the line, zero-indexing, reverse ranges, and regular expression field separators using Rust's regex syntax.

OPTIONS

-c, --character-wise
    Choose fields by character number.

-d, --debug
    Activate debug mode.

-x, --exclusive
    Use exclusive ranges, similar to array indexing in many programming languages.

-n, --non-greedy
    Use non-greedy field separators.

-f, --field-separator <field-separator>
    Specify field separator other than whitespace, using Rust regex syntax.

-i, --input <input>
    Read from <input> file instead of standard input.

-o, --output-field-separator <output-field-separator>
    Specify output field separator.

-h, --help
    Prints help information.

-V, --version
    Prints version information.

ARGUMENTS

<choices>...
    Fields to print. Either a, a:b, a..b, or a..=b, where a and b are integers.

The beginning or end of a range can be omitted, resulting in including the beginning or end of the line, respectively. a:b is inclusive of b (unless overridden by -x). a..b is exclusive of b and a..=b is inclusive of b.

EXAMPLES

choose 5
    Print the 5th item from a line (zero indexed).

choose -f ':' 0 3 5
    Print the 0th, 3rd, and 5th item from a line, where items are separated by ':' instead of whitespace.

choose 2:5
    Print everything from the 2nd to 5th item on the line, inclusive of the 5th.

choose -x 2:5
    Print everything from the 2nd to 5th item on the line, exclusive of the 5th.

choose :3
    Print the beginning of the line to the 3rd item.

choose -x :3
    Print the beginning of the line to the 3rd item, exclusive.

choose 3:
    Print the third item to the end of the line.

choose -1
    Print the last item from a line.

choose -3:-1
    Print the last three items from a line.

AUTHOR
Ryan Geary <rtgnj42@gmail.com>

This manual page was written by Ching He <heqing@rool.me> for the Debian project (and may be used by others).