Use NUL separators to make filename parsing safe.
Section: Encodings and text quirks
Print NUL-delimited paths
bash
bash
rg -l -0 'TODO' . | xargs -0 sed -n '1p'Explanation
This is the shell-safe way to handle paths with spaces or newlines.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Encodings and text quirks
Disable line numbers for transformed output
Print cleaner replacement previews.
Preview a simple replacement
Show what matched lines would look like after substitution.