mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-04-30 01:11:14 -03:00
Add string split --fields
This commit is contained in:
committed by
Fabian Homborg
parent
a29bc127ce
commit
7cb1d3a646
@@ -8,8 +8,8 @@ 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
|
||||
|
||||
@@ -18,7 +18,7 @@ Description
|
||||
|
||||
.. BEGIN 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.
|
||||
``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). Use ``-f`` or ``--fields`` to print out specific fields. Exit status: 0 if at least one split was performed, or 1 otherwise.
|
||||
|
||||
See also the ``--delimiter`` option of the :ref:`read <cmd-read>` command.
|
||||
|
||||
@@ -49,6 +49,11 @@ Examples
|
||||
b
|
||||
c
|
||||
|
||||
>_ string split -f1,3 '' abc
|
||||
a
|
||||
c
|
||||
|
||||
|
||||
NUL Delimited Examples
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
Reference in New Issue
Block a user