Pipes & Text Processing
Compose CLI tools to analyze build output, JSON logs, benchmark CSVs, and git stats without opening a spreadsheet.
Search across all documentation pages
Compose CLI tools to analyze build output, JSON logs, benchmark CSVs, and git stats without opening a spreadsheet.
cargo test 2>&1 | tee test.log
rg "FAILED" test.log | wc -l
cargo tree -e no-dev | sort | uniq -c | sort -rn | headWhen to reach for this:
cargo tree# Slowest tests from nextest output (example pattern)
cargo nextest run 2>&1 | rg "PASS|FAIL" | sort | uniq -c
# JSON log lines (tracing JSON subscriber)
rg '"level":"ERROR"' /var/log/my-service.log | jq -r '.message'
# Top 10 largest files in src
fd . src -t f | xargs wc -l | sort -n | tail -10
# Authors by commit count last month
git log --since="1 month ago" --format='%an' | sort | uniq -c | sort -rn | headWhat this demonstrates:
tee preserves output while saving filejq parses structured Rust logs# Extract crate names from clippy warnings
cargo clippy 2>&1 | rg 'warning:.*\((.*)\)' -r '$1' | sort -u
# Filter benchmark CSV
awk -F, '$3 > 100 {print $1,$3}' bench.csvUse cargo metadata --format-version=1 | jq for scripting workspace graphs.
head closes early. Fix: ignore or | head || true.xargs splits wrong. Fix: fd -0 | xargs -0.rg first.LC_ALL=C sort.cat overload. Fix: stream with rg or less.| Alternative | Use When | Don't Use When |
|---|---|---|
| Polars CLI / Python | Heavy analytics | One-liner counts |
| ClickHouse / Loki | Production log store | Local quick peek |
| Custom Rust script | Repeated pipeline | One-off investigation |
Use rg with regex or install via package manager in onboarding.
-Z timings on nightly outputs HTML; for stable use cargo build with RUSTC_WRAPPER tools.
Stack versions: This page was written for Rust 1.97.0 (edition 2024), Tokio 1.x, Axum 0.8, serde 1.0, sqlx 0.8, clap 4, and Polars 0.46+.
Reviewed by Chris St. John·Last updated Jul 16, 2026