I am extracting certain information from a website using curl command. I need to extract a certain subsection of the string using grep command. For example, using curl command I am getting the HTML page and storing in a variable as below.
page="$(curl http://www.somewebsite.com)"
My extracted HTML page is as below.
<html>
<body>
--------
--------
--------
<div class="section" id="id1" style="display:block">
<div class="header">
<h2>Sub heading here
</h2>
</div>
<div class="content">
<ol class="class1" id="id1">
<li class="">
<span class="jellybean">
</div>
----------
----------
</html>
Now, I need to extract the subsection of the entire div with id="id1". I tried the below command.
output="$(curl http:/somesite.com | grep "id="id1")"
It just gets me the 2 lines where I have id=id1. I need to extract the entire contents between the and tag.