I need to extract specific div content within the file.
The content is as follows.
<div class="container">
<div class="row">
<div class="col-2">One of three columns</div>
<div class="col-6">
<p>One of three columns</p>
</div>
<div class="col-4">One of three columns</div>
</div>
</div>
The following content needs to be extracted.
<div class="col-6">
<p>One of three columns</p>
</div>
I try to do this.
cat test.html | tr -d '\n\t' | grep -o "<div class=\"col-6\">.*<\/div><div class=\"col-4\">"
Return as follows.
<div class="col-6"><p>One of three columns</p></div><div class="col-4">
How do I remove the before and after parts of the content?
<div class="col-6">...</div><div class="col-4">
Thank you in advance!