Skip to content

Instantly share code, notes, and snippets.

@rbricheno
Created July 30, 2019 14:47
Show Gist options
  • Save rbricheno/a799c2ba31c7669b2706c49e93b0300b to your computer and use it in GitHub Desktop.
Save rbricheno/a799c2ba31c7669b2706c49e93b0300b to your computer and use it in GitHub Desktop.
BBC news in the terminal
curl -s http://feeds.bbci.co.uk/news/rss.xml?edition=uk | grep '<description>' | cut -f3 -d "[" | cut -f1 -d "]"
@lespounder
Copy link

Hello, thanks for writing this! Great to see a way to get the news using the terminal.
I've made a slight edit, so that it returns the first five lines (Title and four news stories)

curl -s http://feeds.bbci.co.uk/news/rss.xml?edition=uk | grep '<description>' | cut -f3 -d "[" | cut -f1 -d "]" | head -5

Thanks again!

@ghalfacree
Copy link

Alternatively, have five news stories and no title with this:

curl -s http://feeds.bbci.co.uk/news/rss.xml?edition=uk | grep '<description>' | cut -f3 -d "[" | cut -f1 -d "]" | head -6 | tail -5

@rbricheno
Copy link
Author

And why not make it more readable, with awk?

curl -s http://feeds.bbci.co.uk/news/rss.xml?edition=uk | grep '<description>' | cut -f3 -d "[" | cut -f1 -d "]" | head -6 | tail -5 | awk 'NR == 1 {print ""}; sub(/^/, " "); {print ""}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment