I have a mkdocs instance and am writing a script to print internal links in a page. I cannot get grep to print only the matches if there are multiple per line.
This is what I currently have:
$ grep -Eon '\[([[:alpha:]]|[[:digit:]]|[[:space:]])*\]\((\/|\.).*\)' /path/to/file.md 10:[foo](../../relative_path/foobar.md) is the path to another file, also see [bar](/absolute/path/foobar.md) I would like the output to look like this:
10:[foo](../../relative_path/foobar.md) 10:[bar](/absolute/path/foobar.md) Is there a way to do this in grep or even another command like awk or sed?