TL;DR — Quick Summary

choose is a human-friendly alternative to cut and awk. Select fields from text with simple syntax — choose 0 2 instead of awk '{print $1,$3}'.

choose makes field selection painless. No more awk '{print $1,$3}' or cut -d' ' -f1,3 — just choose 0 2.

Installation

# macOS
brew install choose-rust

# Cargo
cargo install choose

# Arch (AUR)
yay -S choose-rust

Usage

# Select fields (0-indexed)
echo 'hello world foo bar' | choose 0            # hello
echo 'hello world foo bar' | choose 0 2          # hello foo
echo 'hello world foo bar' | choose 2 0          # foo hello (reorder!)

# Ranges
echo 'a b c d e' | choose 0:2                    # a b c
echo 'a b c d e' | choose 2:                     # c d e
echo 'a b c d e' | choose :2                     # a b c

# Negative indices
echo 'a b c d e' | choose -1                     # e (last)
echo 'a b c d e' | choose -2                     # d (second to last)

# Custom delimiters
echo 'user:1000:home' | choose -f ':' 0 2        # user home
cat /etc/passwd | choose -f ':' 0 5              # username shell

# Real-world examples
ps aux | choose 0 1 10                            # user pid command
docker ps | choose 0 1 -1                         # container_id image names
ls -la | choose 4 -1                              # size filename

# Output delimiter
echo 'a b c' | choose -o ',' 0 1 2                # a,b,c

# Exclusive ranges
echo 'a b c d e' | choose --exclusive 0:2         # a b (excludes 2)

Comparison

Featurechoosecutawk
Indexing0-based1-based1-based
WhitespaceAutoExactAuto
ReorderYesNoYes
RangesYesYesManual
NegativeYesNoNo
SyntaxSimpleFlagsLanguage
SpeedFastFastMedium

Summary

  • choose selects fields with simple, human-friendly syntax
  • Zero-indexed, handles variable whitespace automatically
  • Supports ranges (0:2), negative indices (-1), and field reordering
  • Custom delimiters, output separators, and exclusive ranges
  • Written in Rust — drop-in replacement for cut/awk field selection