I am trying to find which of a bunch of HTML files have a heading with the word Agent with the name of a particular agent anywhere after that heading.
So typically something like
<h3>Agent</h3>
<p>Blah blah blah </p>
<p>Their agent is XYZ Corp.</p>
should be found
But I cant guarantee any regularity on markup or content between the heading and the instance of XYZ Corp. So in something like DOS I might search for 'Agent*XYZ' meaning
-match the string 'Agent'
-followed by anything
-followed by the string 'XYZ'
How do I write that in grep on Ubuntu? I have tried
grep -lc 'Agent*XYZ' *.html
grep -lc 'Agent.*?XYZ' *.html
both without success. I can find the pattern manually in more than one of the files, so I know it exists.
TIA