Skip to content

Instantly share code, notes, and snippets.

@stesie
Last active December 23, 2015 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stesie/6561677 to your computer and use it in GitHub Desktop.
Save stesie/6561677 to your computer and use it in GitHub Desktop.
german-bash.org to RSS converter written in sed
#! /bin/sed -nf
#
# Generate RSS-Feed from http://www.german-bash.org/action/latest
#
# Copyright (C) 2008,2011 by Stefan Siegl <stesie@brokenpipe.de>
# License: GPLv3+
#
# Use it like this:
# wget -U "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100618 Iceweasel/3.5.9 (like Firefox/3.5.9)" \
# -q -O- "http://www.german-bash.org/action/latest" | gbo-to-rss
#
/<html/ { c\
<?xml version="1.0" encoding="utf-8"?>\
<rss version="2.0">\
<channel>\
<title>GBO Quotes</title>\
<description>german-bash.org - Die neuesten Zitate</description>\
<language>de-de</language>
p
}
/<span class="id"><a title="Zeige Zitat/ { s|^[^0-9]*\([0-9]\+\).*|<item>\
<title>GBO Quote \1</title>\
<link>http://www.german-bash.org/\1</link>\
<description><![CDATA[\
<p>|; p
}
/<div class="zitat">$/ { :quoteloop
n
/<span class="quote_zeile">/ {
/<\/span>/!n
s|<[^>]*>||g; s|^[ \t]*||; s|$| <br />|; p; bquoteloop
}
c </p>\
]]></description></item>
}
/<\/html/ { c </channel></rss>
p
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment