Stop after a fixed number of matches in each file.
Section: Reporting and scripting
Limit matches per file
bash
bash
rg -m 3 'deprecated' src/Explanation
Speeds up scans when you only need sample hits, not exhaustive results.
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 Reporting and scripting
Print summary statistics
Show counts and timing information at the end of a search.
Disable file headings
Print file names inline per match instead of grouped headings.