For @option{-f}, do not print lines that do not contain the field separator
character. Normally, any line without a field separator is printed verbatim.
-@optItem{cut,--output-delimiter,=@var{string}}
+@optItem{cut,-O,@w{ }@var{string}}
+@optItemx{cut,--output-delimiter,=@var{string}}
With @option{-f}, output fields are separated by @var{string}.
The default with @option{-f} is to use the input delimiter.
When using @option{-b} or @option{-c} to select ranges of byte or
non-character as a pseudo short option, starting with CHAR_MAX + 1. */
enum
{
- OUTPUT_DELIMITER_OPTION = CHAR_MAX + 1,
- COMPLEMENT_OPTION
+ COMPLEMENT_OPTION = CHAR_MAX + 1
};
static struct option const longopts[] =
{"no-partial", no_argument, NULL, 'n'},
{"whitespace-delimited", no_argument, NULL, 'w'},
{"only-delimited", no_argument, NULL, 's'},
- {"output-delimiter", required_argument, NULL, OUTPUT_DELIMITER_OPTION},
+ {"output-delimiter", required_argument, NULL, 'O'},
{"complement", no_argument, NULL, COMPLEMENT_OPTION},
{"zero-terminated", no_argument, NULL, 'z'},
{GETOPT_HELP_OPTION_DECL},
with -b, don't output partial multi-byte characters\n\
"));
oputs (_("\
- -s, --only-delimited\n\
- do not print lines not containing delimiters\n\
-"));
- oputs (_("\
- --output-delimiter=STRING\n\
+ -O, --output-delimiter=STRING\n\
use STRING as the output delimiter;\n\
the default is to use the input delimiter\n\
+"));
+ oputs (_("\
+ -s, --only-delimited\n\
+ do not print lines not containing delimiters\n\
"));
oputs (_("\
-w, --whitespace-delimited\n\
atexit (close_stdout);
- while ((optc = getopt_long (argc, argv, "b:c:d:f:nszw", longopts, NULL))
+ while ((optc = getopt_long (argc, argv, "b:c:d:f:nO:szw", longopts, NULL))
!= -1)
{
switch (optc)
whitespace_delimited = true;
break;
- case OUTPUT_DELIMITER_OPTION:
+ case 'O':
/* Interpret --output-delimiter='' to mean
'use the NUL byte as the delimiter.' */
output_delimiter_length = (optarg[0] == '\0'
['o-delim', qw(-d: --out=_), '-f2,3', {IN=>"a:b:c\n"}, {OUT=>"b_c\n"}],
['nul-idelim', qw(-d '' --out=_), '-f2,3', {IN=>"a\0b\0c\n"}, {OUT=>"b_c\n"}],
['nul-odelim', qw(-d: --out=), '-f2,3', {IN=>"a:b:c\n"}, {OUT=>"b\0c\n"}],
- ['multichar-od', qw(-d: --out=_._), '-f2,3', {IN=>"a:b:c\n"},
- {OUT=>"b_._c\n"}],
+ ['multichar-od', qw(-d: -O _._), '-f2,3', {IN=>"a:b:c\n"}, {OUT=>"b_._c\n"}],
# Ensure delim is not allowed without a field
# Prior to 8.21, a NUL delim was allowed without a field