> For the complete documentation index, see [llms.txt](https://ploegert.gitbook.io/til/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ploegert.gitbook.io/til/os/unix/search-query/only-show-the-matches.md).

# Only Show The Matches

Tools like `grep`, `ack`, and `ag` make it easy to search for lines in a file that contain certain text and patterns. They all come with the `-o` flag which tells them to only show the part that matches.

This is particularly powerful when used with regex and piped into other programs.

h/t Dillon Hafer
