I have parsed all rows containing urls from a text file and appended line breaks, and I want to make the links clickable in a new file.
How do I append <a href> -tags around only the urls, using standard linux tools, preferably awk?
It needs to be automatable in cron.
For example,
source file chaturls.txt:
12:30 <user> check this: https://link.to/stuff.jpg</br>
13:47 <user4> https://another.link.lol eyyyy</br>
desired output in new file, chatlinkified.html:
12:30 <user> check this: <a href='https://link.to/stuff.jpg'>https://link.to/stuff.jpg</a></br>
13:47 <user4> <a href='https://another.link.lol'>https://another.link.lol</a> eyyyy</br>
I tried awk '{printf "<a href=\"%s\">%s</a><br>", $0,$0}' chaturls.txt > chatlinkified.html, but this makes the whole line an (invalid) clickable link.