mardi 30 décembre 2014

Error getting the string between two patterns


I want to get a string between two patterns. The pattern is the first environment <p> </p> in an html file.



<p>Sorcery,
R (1)
</p>
<p class="ctext"><b>As an additional cost to cast Goblin Grenade, sacrifice a Goblin.<br><br>Goblin Grenade deals 5 damage to target creature or player.</b></p>


<p><i>Don't underestimate the aerodynamic qualities of the common goblin.</i></p>
<p>Illus. Kev Walker</p>


That environment is the first of the file so I discard everything matched until the <p> and I want to delete everything after the </p>.



name="goblin grenade"
wget -O- http://magiccards.info/query?q="$name" | grep -oP '<p>\K[^<]+'


I don't know why it doesn't work properly. I get



Sorcery,
Illus. Kev Walker


Aucun commentaire:

Enregistrer un commentaire