I'm trying to figure how to add a prefix at the beggining of each line where the lines are the output of curl:
I have the following command and output:
curl -s https://www.url.com/ | grep -Eo '/news/[^ >]+'
/news/category/title-new-bla-bla
/news/category2/title-new-bla-bla2
/news/category3/title-new-bla-bla3
/news/category4/title-new-bla-bla4
I would to add to my command, maybe using sed or another tool, the prefix https://www.url.com/
to each line as follows:
https://www.url.com/news/category/title-new-bla-bla
https://www.url.com/news/category2/title-new-bla-bla2
https://www.url.com/news/category3/title-new-bla-bla3
https://www.url.com/news/category4/title-new-bla-bla4
Any help would me amazing please!
Here is a simple solution:
curl -s https://www.url.com/ \
| grep -Eo '/news/[^ >]+' \
| xargs -I "{}" echo "https://www.url.com{}"