I have some text in which I want to replace with an actual link.
The text looks like this:
Some text here
[...]
- CRAN Task View: [Bayesian](Bayesian.html)
- CRAN Task View: [Cluster](Cluster.html)
- CRAN Task View: [Databases](Databases.html)
- CRAN Task View: [Environmetrics](Environmetrics.html)
[...]
End of text here
But as you can see, there is no HTML link to the pages. E.g., Bayesian.html should be http://cran.rstudio.com/web/views/Bayesian.html
The final result should be
Some text here
[...]
- CRAN Task View: [Bayesian](http://cran.rstudio.com/web/views/Bayesian.html)
- CRAN Task View: [Cluster](http://cran.rstudio.com/web/views/Cluster.html)
- CRAN Task View: [Databases](http://cran.rstudio.com/web/views/Databases.html)
- CRAN Task View: [Environmetrics](http://cran.rstudio.com/web/views/Environmetrics.html)
[...]
End of text here
So far, I was able to "subset" my text file using the following command:
grep "CRAN Task View: \[" $FILE
But when I try to pipe to this:
sed -e 's|\\([a-zA-Z]*\\)\\.html|http://cran.rstudio.com/web/views/\\1.html|'
It doesn't work. How would it be possible to sed inline from the grep command?
I'm on macOS Mojave.