If the file were correct xml, you could use an xml parsing tool. Otherwise, assuming there's no other (nested) div section inside that section, you could do:
pcregrep -Mo '(?s)<div[^>]*id="id1".*?</div>' the-file.html
If the file were correct xml, you could use an xml parsing tool. Otherwise, assuming there's no other (nested) div section inside that section, you could do:
pcregrep -Mo '(?s)<div[^>]*id="id1".*?</div>' the-file.html