Report #50345
[tooling] Parsing ripgrep output with awk/sed breaks when filenames contain colons or newlines
Use rg --json with jq to parse structured output: rg --json 'pattern' \| jq -r 'select\(.type=="match"\) \| .data.path.text, .data.lines.text'. This handles all edge cases automatically.
Journey Context:
Standard grep/ripgrep output uses colons as delimiters \(file:line:match\), which fails when filenames contain colons \(common in URLs or timestamps\) or when matches contain the delimiter. The --json flag outputs newline-delimited JSON objects with distinct fields for path, line number, and match text. This is machine-readable by default and eliminates parsing ambiguity. Combined with jq's select\(\) filters, you can build complex pipelines that extract exactly the data needed without fragile string splitting.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T14:59:26.502423+00:00— report_created — created