If you've ever used the Unix cut
command but wished it could do more—like filtering rows by content, handling CSV headers, or using regular expressions—then xcut
might be what you're looking for.
xcut
is a command-line tool written in Rust that extends the capabilities of cut
, awk
, and grep
. It's ideal for processing logs, tabular data, or structured plain-text files with customizable delimiters and filters.
🔧 Features
- Column-based extraction (
--cols
) - Regex & boolean filtering (
--filter
) - Custom delimiters (
--delim
,--max-split
) - Output formatting (
--out-delim
,--output
) - Header skipping (
--no-header
) -
head
andtail
-like line selection
📦 Installation
Using Homebrew (macOS/Linux):
brew tap kyotalab/xcut
brew install xcut
Using GitHub Releases:
curl -LO https://github.com/kyotalab/xcut/releases/latest/download/xcut
chmod +x xcut
./xcut --help
🚀 Examples
Extract specific columns
xcut --input logs.txt --cols 1,3
Filter rows using regex (e.g., lines where col 3 starts with "INFO")
xcut --input logs.txt --filter 'col(3) =~ "^INFO"' --cols 3,4
Handle CSV with headers
xcut --input data.csv --delim ',' --cols 1,2 --no-header
Output to a file and format with a delimiter
xcut --input data.txt --cols 1,3 --out-delim ',' --output result.csv
💡 Why Use xcut?
Unlike traditional tools, xcut
gives you:
- Regex filtering in-line
- Logical expressions for filtering
- Cleaner syntax for column extraction
- Cross-platform behavior with a single binary
📚 Learn More
Give it a ⭐️ on GitHub if you find it useful!
Feel free to share your feedback or contribute to the project 🙌
Top comments (0)