pcut - Cut given fields of text input separated by the given Perl regex



NAME

pcut - Cut given fields of text input separated by the given Perl regex


SYNOPSIS

pcut [OPTIONS] [FILE [FILE [...]]]


DESCRIPTION

Standard cut(1) breaks up input lines by a given single char. pcut(1) does this by the given perl(1)-compatible regular expression. cut(1) outputs fields always in ascending order, without duplication. pcut(1) outputs fields in the requested order, even multiple times if asked so by the -f option.


OPTIONS

-f, --fields NUMBERS

Counted from 1. See cut(1) for syntax.

-d, --delimiter REGEX

Default is whitespace (\s+).

-s, --only-delimited

See the same option in cut(1).

-D, --output-delimiter STRING

Define the output field delimiter. Default is not to use a constant output delimiter, but to preserve the separator substrings as they matched to the pattern of -d option (see --prefer-preceding-delimiter and --prefer-succeeding-delimiter options).

-P, --prefer-preceding-delimiter
--prefer-succeeding-delimiter (default)

Contrary to cut(1), pcut(1) does not always use a constant delimiter char, but a regexp pattern which may match to different substrings between fields in the input lines.

Each output field (except the last one) is followed by that substring which was matched to the delimiter pattern just right after that field in the input.

With --prefer-preceding-delimiter, each output field (except the first one) is similarly preceded by that substring which was matched to the delimiter pattern just before that field in the input.

--delimiter-before-first STRING

Write STRING before field 1 if it is not the first field on the output (in --prefer-preceding-delimiter mode).

--delimiter-after-last STRING

Write STRING after the last field if it is written not as the last field on the output.

-z, --zero-terminated

Terminate output records (lines) by NUL char instead of LineFeed.


LIMITATIONS


SEE ALSO

cut(1), hck, tuc, rextr(1), arr(1) arr, choose

 pcut - Cut given fields of text input separated by the given Perl regex