I need to get the HTML contents between a pair of given tags using a bash script. As an example, having the HTML code below:
Forgetting Bash due it's limitation, you can use nokogiri as command line util, as explained here.
Example:
curl -s http://example.com/ | nokogiri -e 'puts $_.search('\''a'\'')'