parsm - Parse 'Em - An 'everything' parser, Sedder, Awkker, Grokker, Grepper
Parsm is the powerful command-line tool that understands structured text better than sed, awk, grep or grok.
Overview
parsm automatically detects and parses multiple data formats (JSON, CSV, YAML, TOML, logfmt, and plain text) and provides powerful filtering and templating capabilities through an intuitive syntax.
By default, parsm outputs the original input when a filter matches. For custom output formatting, use templates.
Installation
From crates.io
From source
Or build from source:
Quick Start
# Basic usage
# Examples
# Extract a field
|
# Nested fields
|
# Filtering
|
# Filter and format
|
Supported Formats
- JSON
- CSV
- YAML
- TOML
- Logfmt
- Plain Text
Force Format Parsing
| Flag | Format |
|---|---|
--json |
JSON |
--yaml |
YAML |
--csv |
CSV |
--toml |
TOML |
--logfmt |
logfmt |
--text |
Plain Text |
Syntax Reference
Filters
- Comparison:
==,!=,<,<=,>,>= - String ops:
*=(contains),^=(starts with),$=(ends with),~=(regex match) - Boolean logic:
&&,||,! - Truthy check:
field?
Examples:
&&
Templates
- Variables:
[${name}]or$name - Literal:
[name]
Example:
Field Selectors
- Simple:
name - Nested:
user.email - Quoted (special chars):
'special-field' - CSV/Text:
field_0,word_0
Examples
JSON/YAML/TOML
|
|
CSV
|
Logs
|
CLI Usage
Comparison with Other Tools
| Feature | parsm | jq | awk | sed |
|---|---|---|---|---|
| Multi-format | ✅ JSON, CSV, YAML, TOML, logfmt, text | JSON only | Text | Text |
| Auto-detection | ✅ Automatic | ❌ Manual | ❌ Manual | ❌ Manual |
| Field extraction | ✅ Simple name syntax |
✅ .name syntax |
Limited | ❌ No |
| Simple syntax | ✅ Low | Medium | Complex | Medium |
Development
- Build:
cargo build - Test:
cargo test - Lint:
cargo fmt && cargo clippy
Contributing
- Fork repository
- Create feature branch
- Write tests and code
- Run tests and lint checks
- Submit a pull request
License
See LICENSE.
Changelog
See CHANGELOG.md.
Examples
# Basic filtering - outputs original input when filter matches
|
# Output: {"name": "Alice", "age": 30}
# Filtering with custom template
|
# Output: Alice is 30
# Access original input in templates with ${0}
|
# Output: Original: {"name": "Alice", "age": 30}, Name: Alice