tuc
Enhanced text field cutting and splitting
TLDR
Cut the first field (tab-delimited)
SYNOPSIS
tuc [flags] [options] [file]
DESCRIPTION
tuc is a modern alternative to the classic cut command, written in Rust. It provides enhanced field selection with features like negative indexing, regex delimiters, multi-character delimiters, and field reordering.
Field syntax supports ranges (1:3), lists (1,3,5), negative indexes (-1 for last), and combinations. Template formatting with {1}, {2} allows custom output formatting.
Unlike cut, tuc can reorder fields, use regex patterns for splitting, and handle Unicode characters correctly. The -g option treats consecutive delimiters as one, useful for whitespace-separated data with variable spacing.
PARAMETERS
-f, --fields bounds
Fields to select (default: 1:)-b, --bytes bounds
Select specific bytes-c, --characters bounds
Select characters (UTF-8 aware)-l, --lines bounds
Select lines-d, --delimiter delim
Field delimiter (default: tab)-e, --regex pattern
Use regex as delimiter-r, --replace-delimiter text
Replace delimiter with custom text-t, --trim type
Trim delimiters: l (left), r (right), b (both)-g, --greedy-delimiter
Match consecutive delimiters as one-p, --compress-delimiter
Merge consecutive delimiters before cutting-s, --only-delimited
Show only lines containing the delimiter-m, --complement
Invert field selection-j, --join
Rejoin selected parts with the delimiter-z, --zero-terminated
Use NUL instead of newline as line terminator--json
Output fields as JSON array
CAVEATS
Regex support increases binary size; build with --no-default-features for a smaller binary. Field numbering starts at 1, not 0. The default delimiter is tab, not whitespace.
HISTORY
tuc was created by Riccardo Attilio Galli (riquito) as a Rust-based enhancement to the traditional cut utility. The name is a playful reversal of "cut." The project was motivated by cut's limitations with regex delimiters, field reordering, and negative indexing.
