[Linux-disciples] Perl pattern matching
Adam Rosi-Kessel
adam at rosi-kessel.org
Fri Nov 18 10:44:13 EST 2005
I think it has something to do with the way you are invoking perl. Two data
points:
wget -O -
'http://rss.netflix.com/QueueRSS?id=P2020071624879355028177181315700043' |
perl -e "while(<>) { \
if( m{<item>}..m{</item>} ) { \
if( m{<title>(.*?)</title>} ) { \
print "HI STEVE"; \
} \
} \
}"
Gives no results.
But:
wget -O netflix.rss \
'http://rss.netflix.com/QueueRSS?id=P2020071624879355028177181315700043'
cat netflix.rss | perlscript.pl
where perlscript is the abovementioned script
works fine.
I would suggest in general doing all of this stuff from within a perl script
rather than fidgeting with pipes and wget output.
Stephen R Laniel wrote:
> Any idea why this isn't working the way I think it should
> work?
>
> (10:16) slaniel at TheloniousMonk:~$ wget -O - 'http://rss.netflix.com/QueueRSS?id=P2020071624879355028177181315700043' 2>/dev/null |perl -e "while(<>) { \
> if( m{<item>}..m{</item>} ) { \
> if( m{<title>(.*?)</title>} ) { \
> print $1; \
> } \
> } \
> }"
>
> The "$1" bit should, I think, print only the bits of the RSS feed
> that lie between "<title>" and "</title>", but instead I'm
> getting the results below -- which include the </?title>
> bits. Any idea what that's about?
>
> <title>1- City of God</title>
> <title>2- American Splendor</title>
> <title>3- Capturing the Friedmans</title>
> <title>4- Spellbound</title>
> <title>5- Red</title>
> <title>6- The Decalogue: Disc 1: Films I - III</title>
> <title>7- The Decalogue: Disc 2: Films IV - VII</title>
> <title>8- The Decalogue: Disc 3: Films VIII - X</title>
> <title>9- To Catch a Thief</title>
> <title>10- The Maltese Falcon</title>
> <title>11- Batman Begins</title>
> <title>12- Touching the Void</title>
> <title>13- Born Into Brothels</title>
> <title>14- Dark City</title>
> <title>15- Melinda and Melinda</title>
> <title>16- Night and Fog</title>
> <title>17- White</title>
> <title>18- The Life Aquatic with Steve Zissou</title>
> <title>19- The Virgin Suicides</title>
> <title>20- Igby Goes Down</title>
> <title>21- Bonnie and Clyde</title>
> <title>22- A Streetcar Named Desire</title>
> <title>23- Me and You and Everyone We Know</title>
> <title>24- The Philadelphia Story</title>
> <title>25- Gaslight</title>
> <title>26- The Beat That My Heart Skipped</title>
> <title>27- Ray</title>
> <title>28- Paris, Texas</title>
> <title>29- Hiroshima Mon Amour</title>
> <title>30- Nosferatu: Original Version</title>
> <title>31- The Last Picture Show</title>
> <title>32- Crumb</title>
> <title>33- Serpico</title>
> <title>34- The French Connection</title>
> <title>35- Once Upon a Time in the West</title>
> <title>36- Open City</title>
> <title>37- The Testament of Dr. Mabuse</title>
> <title>38- The Trials of Henry Kissinger</title>
> <title>39- Buena Vista Social Club</title>
> <title>40- Open Your Eyes</title>
> <title>41- In the Company of Men</title>
> <title>42- Sanjuro</title>
> <title>43- Casablanca</title>
> <title>44- The King of Comedy</title>
> <title>45- The Hustler</title>
> <title>46- The Last Waltz</title>
> <title>47- Nights of Cabiria</title>
> <title>48- His Girl Friday</title>
> <title>49- The Pawnbroker</title>
> <title>50- Fishing With John</title>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Linux-disciples mailing list
> Linux-disciples at lists.bostoncoop.net
> http://lists.bostoncoop.net/mailman/listinfo/linux-disciples
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 250 bytes
Desc: OpenPGP digital signature
Url : http://lists.bostoncoop.net/pipermail/linux-disciples/attachments/20051118/7fc046c8/signature.pgp
More information about the Linux-disciples
mailing list