Reputation: 13
When I use curl with this link to find the current artist and title:
curl -H 'Cache-Control: no-cache' -t utf-8 \
-s http://www.radiopilatus.ch/livecenter?action=webradio \
| grep "Jetzt Läuft" -A3 | tail -n 1
The output is both the artist and title - e.g.:
STEFANIE HEINZMANN
DIGGIN' IN THE DIRT
it should just be the title - e.g.:
DIGGIN' IN THE DIRT
How can the title be returned (without the artist)?
yes this is correct, The <br>
is not my problem.
I have not see here is automatic changed from :
- How can change to correct output?
Upvotes: 0
Views: 181
Reputation: 8297
It appears that the call/pipe to grep
finds the line containing both the artist and title, with a break tag (i.e. <br>
) between the two.
In order to only show the title, you may need to use a string function (e.g. sed) to remove the contents before the break tag.
curl -H 'Cache-Control: no-cache' -t utf-8 -s http://www.radiopilatus.ch/livecenter?action=webradio | grep "Jetzt Läuft" -A3 | tail -n 1 |sed -e 's/.*<br>//'
You can see this in action on Teh (PHP) Playground.
Upvotes: 1