I want to get text between < H2 > tags . The code I wrote was
grep -oP "<H2>.*?</H2>" redirect.html
The answer I get is
<H2><A NAME="s3">3. All about redirection</A> </H2>
I want to remove the < H2 > and < /H2 > by changing the regular expression there.
>Solution :
Try using this,
grep -oP "(?<=<H2>).*?(?= </H2>)" redirect.html