2 releases
| 0.1.1 | Sep 8, 2025 |
|---|---|
| 0.1.0 | Nov 20, 2022 |
#440 in Command line utilities
73 downloads per month
90KB
2K
SLoC
ock
ock is a lightweight command-line tool for slicing tabular data. It covers many everyday awk tasks with a simpler, faster interface.
The project started as an effort to learn Rust and forget awk. It became useful enough for me and I stopped maintaining it. Now, thanks to the fine folks at Anthropic and OpenAI making the cost of code maintenance ~zero, the project is back under active development.
Features
- Select columns by index or header
- Slice rows and columns with Python-like ranges
- Filter using regular expressions
- Work with custom row and column delimiters
Installation
From crates.io
cargo install ock
Using cargo-binstall
cargo binstall ock
Pre-built binaries
Download pre-built binaries for your platform from the releases page.
Available for:
- Linux (x86_64, aarch64)
- macOS (x86_64, Apple Silicon)
- Windows (x86_64)
Usage
Select columns
ps aux | ock -c pid,command # by header
ps aux | ock -c 1,3 # by index
Slice rows
ps aux | ock -c pid -r 0:10 # first ten rows
ps aux | ock -r -5: # last five rows
Filter with regex
ps aux | ock -r 'python(2|3)' # rows matching a pattern
ps aux | ock -c '/^pid|cmd$/' # columns by regex
Custom delimiters
ock -r 1:10 -c 1,5 --column-delimiter ',' data.csv
Combine operations
ps aux | ock -c pid,command -r 'python'
Out-of-bounds selections produce a warning and no output.
License
MIT license. See LICENSE for details.
Dependencies
~4–5.5MB
~94K SLoC