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 foundBut 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' *.htmlgrep -lc 'Agent.*?XYZ' *.htmlboth without success. I can find the pattern manually in more than one of the files, so I know it exists.TIA
Regex pattern with grep for expression2 AFTER expression1
ubuntu;grep;regular expression