Document string split --fields

- The parameter-listing appears to have been lost as a part of
  14d60ccb32
This commit is contained in:
Henrik Hørlück Berg
2022-05-02 17:19:37 +02:00
committed by Fabian Boehm
parent dd95e0a0ea
commit 837c446dc6
2 changed files with 11 additions and 10 deletions

View File

@@ -8,10 +8,10 @@ Synopsis
.. synopsis::
string split [(-m | --max) MAX] [-n | --no-empty] [-q | --quiet]
[-r | --right] SEP [STRING ...]
string split0 [(-m | --max) MAX] [-n | --no-empty] [-q | --quiet]
[-r | --right] [STRING ...]
string split [-f | --fields] FIELDS [(-m | --max) MAX] [-n | --no-empty]
[-q | --quiet] [-r | --right] SEP [STRING ...]
string split0 [-f | --fields] FIELDS [(-m | --max) MAX] [-n | --no-empty]
[-q | --quiet] [-r | --right] [STRING ...]
.. END SYNOPSIS
@@ -22,7 +22,7 @@ Description
``string split`` splits each *STRING* on the separator *SEP*, which can be an empty string. If **-m** or **--max** is specified, at most MAX splits are done on each *STRING*. If **-r** or **--right** is given, splitting is performed right-to-left. This is useful in combination with **-m** or **--max**. With **-n** or **--no-empty**, empty results are excluded from consideration (e.g. ``hello\n\nworld`` would expand to two strings and not three). Exit status: 0 if at least one split was performed, or 1 otherwise.
Use **-f** or **--fields** to print out specific fields. Unless **--allow-empty** is used, if a given field does not exist, then the command exits with status 1 and does not print anything.
Use **-f** or **--fields** to print out specific fields. FIELDS is a comma-separated string of field numbers and/or spans. Each field is one-indexed, and will be printed on separate lines. If a given field does not exist, then the command exits with status 1 and does not print anything, unless **--allow-empty** is used.
See also the **--delimiter** option of the :ref:`read <cmd-read>` command.
@@ -53,9 +53,10 @@ Examples
b
c
>_ string split --allow-empty -f1,3,5 '' abc
>_ string split --allow-empty -f1,3-4,5 '' abcd
a
c
d
NUL Delimited Examples