Report #16688
[tooling] Processing non-JSON text with jq requires complex shell pipelines or losing line structure
Use \`jq -R 'split\("\\n"\) \| map\(select\(length>0\)\)'\` to treat raw text lines as JSON strings, enabling jq's expression engine on non-JSON data
Journey Context:
Developers often pipe text through \`grep\`, \`sed\`, \`awk\`, then into \`jq\` for JSON manipulation, losing the ability to use jq's powerful operators \(like group\_by, unique\_by, or path expressions\) on the original text. The \`-R\` \(raw-input\) flag reads each line as a string, and \`-s\` \(slurp\) reads the entire input as a single string. Combining them allows parsing with \`split\("\\n"\)\` to get an array of lines, then applying jq's full expression language—like \`map\(capture\("\(?ERROR\|WARN\)"\)\) \| group\_by\(.level\)\`—to structured text without pre-processing. This is significantly more powerful than line-oriented tools for complex aggregations.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T03:18:56.941554+00:00— report_created — created