parts

command module
v0.0.0-...-2a58180 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

README

parts - Reads text input to split parts by given separator and prints the chosen range.

Usage:
  parts [OPTIONS] RANGE

Options:
  -f | --file FILENAME		| Use FILENAME as input.
  -s | --split SEPARATOR	| Split input by SEPARATOR. (defaults to %C)
  -n | --num			| Show number of parts available for given options.

  --help			| Show this help.
  --license			| Print license.
  --version			| Print version.

Separator:
  Any string you want. (see examples below)

  Predefined:
    %C			| Character
    %E			| Empty line
    %N			| Newline
    %S			| Space/Fields

Range:
  Index starts at 0 until max occurrence.

  Usage:
    0			| First part.
    1			| Second part.
    2:4 		| Third and forth parts.
    :4			| Get all from beginning until the forth part.
    3:			| Forth part until the end
    3:-1		| Forth part until second to last.

Examples:
  echo "ABC" | parts 1:		| Split by character, returning the range from second until the last character.
  BC

  echo "ABC" | parts -s "B" 1	| Split by string "B", returning the second (1) part.
  C

  cat /proc/loadavg | parts -s %S 0:3	| Split by spaces (%S), returning all 3 load averages.
  0.11 0.09 0.14

  parts -s %E -f LICENSE -3		| Split by empty lines (%E), returning the second clause of the BSD-3-Clause file.
  2. Redistributions in binary form must reproduce the above copyright notice,
     this list of conditions and the following disclaimer in the documentation
     and/or other materials provided with the distribution.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL