måndag 15 december 2014

xmlstarlet RSS Bash

#!/bin/bash
#!/usr/bin/python
clear
RSS_URL=http://blåljus.se/rss.aspx
wget ${RSS_URL} -O - 2>/dev/null | \
xmlstarlet sel -t -m "/rss/channel/item" \
  -v "guid" -n -v "pubDate" -n -v "title" -n -v "description" -n -v "link" -n -n

# mitt första försök....
#wget -q -O- http://blåljus.se/rss.aspx| awk 'BEGIN{RS="<title>"}
#{
#gsub(/.*<description>|<\/description>.*/,"")
#gsub(/.*<rss version="2.0">|<\/rss>>.*/,"")
#gsub(/.*<channel>|<\/channel>.*/,"")
#gsub(/.*<link><\/link>.*/,"")
#gsub(/.*<language>|<\/language>.*/,"")
#gsub(/.*<pubDate>|<\/pubDate>.*/,"")
#print $0
#}'

Skicka en kommentar