Documentation
¶
Index ¶
- func RunSort(w io.Writer, r io.Reader, args []string, opts SortOptions) error
- func RunUniq(w io.Writer, r io.Reader, args []string, opts UniqOptions) error
- func Sort(lines []string)
- func TrimLines(lines []string) []string
- func Uniq(lines []string) []string
- type SortOptions
- type SortResult
- type UniqLine
- type UniqOptions
- type UniqResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunSort ¶
RunSort executes the sort command r is the default input reader (used when args is empty or contains "-")
func RunUniq ¶
RunUniq executes the uniq command r is the default input reader (used when args is empty or contains "-")
Types ¶
type SortOptions ¶
type SortOptions struct {
Reverse bool // -r: reverse the result of comparisons
Numeric bool // -n: compare according to string numerical value
Unique bool // -u: output only unique lines
IgnoreCase bool // -f: fold lower case to upper case characters
IgnoreLeading bool // -b: ignore leading blanks
Dictionary bool // -d: consider only blanks and alphanumeric characters
Key string // -k: sort via a key
FieldSep string // -t: use SEP as field separator
Check bool // -c: check for sorted input
Stable bool // -s: stabilize sort by disabling last-resort comparison
Output string // -o: write result to FILE
JSON bool // --json: output as JSON
}
SortOptions configures the sort command behavior
type SortResult ¶
SortResult represents sort output for JSON
type UniqOptions ¶
type UniqOptions struct {
Count bool // -c: prefix lines by the number of occurrences
Repeated bool // -d: only print duplicate lines
AllRepeated bool // -D: print all duplicate lines
IgnoreCase bool // -i: ignore differences in case
Unique bool // -u: only print unique lines
SkipFields int // -f: avoid comparing the first N fields
SkipChars int // -s: avoid comparing the first N characters
CheckChars int // -w: compare no more than N characters
ZeroTerminate bool // -z: line delimiter is NUL, not newline
JSON bool // --json: output as JSON
}
UniqOptions configures the uniq command behavior
type UniqResult ¶
UniqResult represents uniq output for JSON
Click to show internal directories.
Click to hide internal directories.