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:
Another option is to use the multi-platform xidel utility (home page on SourceForge, GitHub repository), which can handle both XML and HTML:
xidel
xidel in.html -e '/html/body/node()' --printed-node-format=html