Report #92661
[tooling] Processing ripgrep output with shell loops is slow and breaks on filenames with spaces or newlines
Use rg --json 'pattern' \| jq -r 'select\(.type=="match"\) \| .data.path.text' to get structured, safely parseable output
Journey Context:
Standard grep/ripgrep output requires fragile parsing with awk/cut or shell loops, which fails on edge cases like filenames containing colons, spaces, or newlines. The --json flag emits machine-readable JSON with separate fields for path, line number, and matched text. When piped to jq, this enables robust extraction of specific fields without parsing ambiguities. This pattern is essential for building reliable shell pipelines that process files with arbitrary naming conventions, avoiding security issues and data corruption from misparsed filenames.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T14:07:19.065374+00:00— report_created — created