In a bash script (on Ubuntu 14.04) I'm running the command:
WP055="$(wget -qO - http://alerts.weather.gov/cap/wwaatmget.php?x=CAZ055&y=1)"
Within the WP055 variable string there will be an unknown number of '<title>' and '</title>' pairs. I need to search within each of these pairs for the string 'by NWS' which means this particular string contains the start and end time of the particular weather advisory. This found string (all the characters between the opening and closing title tags) is what I'm looking to capture into another variable so that I can drop it into an index.html file the script is building.
I was planning on looping through the WP055 variable x number of times analyzing the text within each pair of tags until I find the correct one.
I can't search WP055 for 'by NWS' because there may be more than one occurrence within WP055 (multiple advisories within the WP055 string).
(The above wget command will definitely have a 'by NWS' string within the 2nd title pair until March 07 at 3:00AM PST, when the current wind advisory will be cancelled.)