I have been trying for quite some time to extract part of a text (a header) in bash script
but I have not succeeded, this is what I have:
link: <https://api.some.com/v1/monitor/zzsomeLongIdzz?access_token=xxSomeLongTokenxx==>; rel="monitor",<https://api.some.com/v1/services/xx/something-more/accounts/2345?access_token=xxSomeLongTokenxx==>; rel="parent"
Here with a little format so you can see it better
link:
<https://api.some.com/v1/monitor/zzsomeLongIdzz?access_token=xxSomeLongTokenxx==>;
rel="monitor",
<https://api.some.com/v1/services/xx/something-more/accounts/2345?access_token=xxSomeLongTokenxx==>;
rel="parent"
I need the second part, only the url
, basically the values between ,<
and >; rel="parent"
and assign that to a variable, something like:
my_url = $(echo $complete_header) <== aplicarle alguna forma de filtro
I have no idea how to apply a pattern or regex to extract the data I need. I used to use jq
to filter json
, something like:
error_message=$(echo $response | jq '.["errors"]|.[0]|.["message"]')
Unfortunately for me this is not json
.
Can someone help me to go in the right direction to my question?
If the solution were with regex I would like you to give me a summary of what that regex means, enough to be able to modify it.