vehemoth
September 2nd, 2011, 07:35 AM
Two things, first; how do I set a variable from a previously escaped line
and second
#!/bin/bash
#RSS Setup
badlines=6
URI=http://quotes4all.net/rss/240010110/quotes.xml #URI of RSS Feed
firstline=description #Top line to output
extrachar="- " #characters at start of second line
secondline=title #second line to output
quotes=temp
#Work Start
wget -q -O - $URI | sed -e 's/[ \t]*//' |\
sed ':a;N;$!ba;s/<description>\n/<description>/g' | sed ':a;N;$!ba;s/\n<\/description>/<\/description>/g' |\
grep -A 1 '<title>' |\
sed -e :a -e 's/<[^>]*>//g;/</N' |\
head -n $(($badlines+2)) |\
tail -n $((1))
Can I replace this line
sed ':a;N;$!ba;s/<description>\n/<description>/g' | sed ':a;N;$!ba;s/\n<\/description>/<\/description>/g' |\
with something that works with more than just the description tag (it finds the tag and end tag and deletes the new line before or after if there is no contents on that line)
Thanks for your help :)
and second
#!/bin/bash
#RSS Setup
badlines=6
URI=http://quotes4all.net/rss/240010110/quotes.xml #URI of RSS Feed
firstline=description #Top line to output
extrachar="- " #characters at start of second line
secondline=title #second line to output
quotes=temp
#Work Start
wget -q -O - $URI | sed -e 's/[ \t]*//' |\
sed ':a;N;$!ba;s/<description>\n/<description>/g' | sed ':a;N;$!ba;s/\n<\/description>/<\/description>/g' |\
grep -A 1 '<title>' |\
sed -e :a -e 's/<[^>]*>//g;/</N' |\
head -n $(($badlines+2)) |\
tail -n $((1))
Can I replace this line
sed ':a;N;$!ba;s/<description>\n/<description>/g' | sed ':a;N;$!ba;s/\n<\/description>/<\/description>/g' |\
with something that works with more than just the description tag (it finds the tag and end tag and deletes the new line before or after if there is no contents on that line)
Thanks for your help :)