How to print out a list of all BBC news headlines with the command line. This is very cool.

Posted: August 12, 2017. At: 10:28 PM. This was 6 days ago. Post ID: 7641

This simple one-liner will print out all of the news headlines from the BBC news website in a simple text format. This is useful if you want to do something with a list like this. Or if you just want a listing to see if there is anything interesting happening. Updated command for 2017, as it was not working as it used to.

curl -s http://feeds.bbci.co.uk/news/rss.xml | grep "<title>" | sed "s/            <title><\!\[CDATA\[//g;s/\]\]><\/title>//;" | grep -v "BBC News"

Here is this one-liner in action.

[jason@localhost ~]$ curl -s http://feeds.bbci.co.uk/news/rss.xml | grep "<title>" | sed "s/            <title><\!\[CDATA\[//g;s/\]\]><\/title>//;" | grep -v "BBC News" 
North Korea: China urges Trump not to worsen situation
UKIP MEP quits as whip over anti-Islam candidate
Sunderland gas explosion survivor 'saved by fridge'
Golders Green murder: Joshua Cohen wanted by police
Taylor Swift assault case: Judge throws out DJ's lawsuit
US police officer records moment he is shot at close range
East Harling murder: Man held over Peter Wrighton stabbing
Perseid meteor shower set to peak at weekend
Government to consider laser pen licence after attack rise
White nationalist rally at University of Virginia
Danish submarine owner arrested over journalist's death
Drink spiking: Southampton student recounts experience
Corsica fires: Blazes continue in Pietracorbara and Sisco
Week in pictures: 5 - 11 August 2017
The papers: US 'locked and loaded' and childbirth rethink
Hairdressers refuse to shave depressed teen's matted hair
Brian Blessed 'bit off' umbilical cord delivering baby
Antarctica fruitcake: 106-year-old dessert 'left by Capt Scott'
Acid victim: 'I will have my injuries to the grave'
Mexico: An open-top bus tour exposes corruption
Drinking outside the box: Is bag-in-box wine back?
Berlin's new toilets: Would you use a women's urinal?
Secret bunker cannabis growers jailed
'I've come to rescue you': My grandfather at Dunkirk
'Airlines keep breaking my wheelchair'
Magazines: How print is surviving the digital age
The family who brought an Indian sweet to Pakistan
The weird and wonderful world of pub games
How close is Japanese knotweed getting to my home?
For Trump, opulence, golf and nuclear threat
Why is the US dollar falling?
The Italian highlanders who may have Scottish roots
World Championships 2017: Usain Bolt's Jamaica & GB through to relay final
Arsenal 4-3 Leicester City
Man Utd: Why I back Jose Mourinho's side to win Premier League title - Alan Shearer
World Athletics Championships 2017: GB relay teams safely through to 4x100m finals
US PGA Championship 2017: Hideki Matsuyama shoots 64 to share lead with Kevin Kisner

This is a very good way to get a listing of news items in your terminal. Very useful indeed.

Count the number of headlines like this.

[jason@localhost ~]$ curl -s http://feeds.bbci.co.uk/news/rss.xml | grep "<title>" | sed "s/      <title><\!\[CDATA\[//g;s/\]\]><\/title>//;" | grep -v "BBC News" | wc -l
37
2 responses to “How to print out a list of all BBC news headlines with the command line. This is very cool.

Very good script, but how do you get rid of the statical data at the top? I want top see just the beginning of the headline and the rest.
Thanks,
Don

Leave a Reply