User Tools

Site Tools


unix:bash:rss

Code example for XML read with bash from http://stackoverflow.com/questions/893585/how-to-parse-xml-in-bash

filter='(720p|epack|"Month of"\)'

rdom () { local IFS=\> ; read -d \< E C ;}

while rdom; do
   if [[ $E = title ]]; then
        echo $C #|egrep -v $filter
        echo $C |egrep -v $filter
   fi
done < tmp.txt

This unfortunately yields:

-bash-3.2# ./testrdom.sh 
egrep: Unmatched ( or \(
./testrdom.sh: line 8: echo: write error: Broken pipe
blah
egrep: Unmatched ( or \(
bla (US) - blah (720p .mkv) (Repack)
egrep: Unmatched ( or \(
blah - 1x16 - blah (720p .mkv)

An error for every line, despite the fact that some lines do not contain “(” or “)”.

unix/bash/rss.txt · Last modified: 2011/03/15 17:01 by ben