Sample Header Ad - 728x90

How to pretty output of grep for searching within markdown files?

0 votes
1 answer
870 views
I have a knowledge base (aka Zettelkasten) of markdown files. And I use searching with the next command grep -irn 'search request' *.md. All works fine. But I'd like see output with the title of the file and sub header of the found string. The sample ### file.md
1 # Title
2
3 ## Subtitle
4
5 yada-yada
### Output
> grep -irn 'yada' *.md

< file.md:5:Title:Subtitle:yada-yada
Can I do this with grep without multiple search in the file? An analogue of [recall](https://www.lesbonscomptes.com/recoll/pages/index-recoll.html) for terminal would be ideal.
Asked by kryn (3 rep)
Nov 12, 2022, 04:23 AM
Last activity: Nov 13, 2022, 04:12 AM