136 private links
This is choose, a human-friendly and fast alternative to cut and (sometimes) awk
Features
terse field selection syntax similar to Python's list slices
negative indexing from end of line
optional start/end index
zero-indexed
reverse ranges
slightly faster than cut for sufficiently long inputs, much faster than awk
regular expression field separators using Rust's regex syntax
Rationale
The AWK programming language is designed for text processing and is extremely capable in this endeavor. However, the awk command is not ideal for rapid shell use, with its requisite quoting of a line wrapped in curly braces, even for the simplest of programs:
awk '{print $1}'
Likewise, cut is far from ideal for rapid shell use, because of its confusing syntax. Field separators and ranges are just plain difficult to get right on the first try.
It is for these reasons that I present to you choose. It is not meant to be a drop-in or complete replacement for either of the aforementioned tools, but rather a simple and intuitive tool to reach for when the basics of awk or cut will do, but the overhead of getting them to behave should not be necessary.