command

package module
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 5 Imported by: 0

README

Documentation

Index

Constants

View Source
const (
	// CutComplement inverts the selection: emit positions NOT in the set.
	CutComplement cutComplementFlag = true
	// CutNoComplement is the default: emit positions in the set.
	CutNoComplement cutComplementFlag = false
)

Variables

This section is empty.

Functions

func Cut

func Cut(opts ...any) gloo.Command[[]byte, []byte]

Cut returns a Command that selects fields, bytes, or characters from each input line, equivalent to the Unix cut(1) utility.

Modes (mutually exclusive, resolved in this order):

  • CutBytes: select bytes by position (-b)
  • CutChars: select characters (runes) by position (-c)
  • CutFields (with CutDelimiter): select fields by position (-f/-d)

CutComplement inverts the selection for any mode. Specs accept comma-separated 1-based positions and ranges, including open-ended ranges: "1,3-5", "2-", "-3".

Types

type CutBytes

type CutBytes string

CutBytes selects bytes by position (-b flag). The spec string uses 1-based positions and ranges: "1-3,5,7-9".

type CutChars

type CutChars string

CutChars selects characters (runes) by position (-c flag). The spec string uses 1-based positions and ranges: "1-3,5,7-9".

type CutDelimiter

type CutDelimiter string

CutDelimiter sets the field delimiter (-d flag). Default is tab.

type CutField

type CutField int

CutField is a 1-based field position selected by the -f flag.

type CutFieldsOpt

type CutFieldsOpt []CutField

CutFieldsOpt selects fields by 1-based position (-f flag).

func CutFields

func CutFields(f ...CutField) CutFieldsOpt

CutFields returns a fields option for Cut.

Directories

Path Synopsis
Package alias provides short names for cut command flags.
Package alias provides short names for cut command flags.

Jump to

Keyboard shortcuts

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