Question title may be kinda vauge, but heres what im attempting to do.
I have a html file locally on my server which is changing fairly regularly. It has multiple occurrences of:
<p>Jumble of random text</p>
<p>More text</p>
And so on...
I want to be able to sort through all the different jumble of random text's till it finds the one i am looking for, for example 'random', which could be anywhere in the file. Then i want a variable assigned to
Jumble of random text
(Everything between the:
<p> and </p>
So far i have this:
echo grep -i 'random' search.html | grep -o -P '(?<=<p>).*(?=</p>)' search.html
Which works to an extent, however it is finding the first occurrence and the last occurrence of the paragraph tags, therefore giving me a huge output of meaningless data, ie in this case:
Jumble of random text
More text
How can i get it to just return:
Jumble of random text
Getting very confused, very fast.
Aucun commentaire:
Enregistrer un commentaire