title_body: How to find duplicate IDs in epub? Chapter_1.xhtml:
  
  &lt;div id="ch1_sec1"&gt;
  &lt;h1 id="level1"&gt;Section 1&lt;/h1&gt;
  &lt;p id="p1"&gt;paragraph1, see &lt;a href="Chapter_1.xhtml#f1"&gt;fig 1&lt;/a&gt;&lt;/p&gt;
  &lt;figure id="f1"&gt;
  &lt;caption&gt;Fig. 1. Caption&lt;/caption&gt;
  &lt;/figure&gt;
  &lt;p id="p2"&gt;paragraph2, see &lt;a href="Chapter_1.xhtml#f1"&gt;fig 2&lt;/a&gt;&lt;/p&gt;
  &lt;p id="p3"&gt;paragraph3&lt;/p&gt;
  &lt;/div&gt;
  
  
  Chapter_2.xhtml:
  
  &lt;div id="ch2_sec1"&gt;
  &lt;h1 id="level1"&gt;Section 1&lt;/h1&gt;
  &lt;p id="p1"&gt;paragraph1&lt;/p&gt;
  &lt;p id="p2"&gt;paragraph2, see &lt;a href="Chapter_1.xhtml#f1"&gt;fig 2&lt;/a&gt;&lt;/p&gt;
  &lt;figure id="f1"&gt;
  &lt;caption&gt;Fig. 2. Caption&lt;/caption&gt;
  &lt;/figure&gt;
  &lt;p id="p3"&gt;paragraph3&lt;/p&gt;
  &lt;/div&gt;
  
  
  Chapter_3.xhtml:
  
  &lt;div id="ch3_sec1"&gt;
  &lt;h1 id="level1"&gt;Section 1&lt;/h1&gt;
  &lt;p id="p1"&gt;paragraph1&lt;/p&gt;
  &lt;p id="p2"&gt;paragraph2&lt;/p&gt;
  &lt;p id="p3"&gt;paragraph3&lt;/p&gt;
  &lt;/div&gt;
  
  
  In above mentioned source file, All the IDs are same except &lt;div&gt; ID.
  In this case, how can i find the duplicates with different filenames (using perl, javascript or anything else).
  
  If you have solution for this, please help.
upvoted_answer: Your best bet is to validate with EPUBCheck. That will catch dupe @ids and other errors. I use a command in Linux similar to:
  
  java -jar /home/epubcheck.jar book.epub -out errors.xml
  
  
  The errors.xml file will give you filename, line numbers, and error descriptions. 
  
  Or you can use an online validator at IDPF if you don't mind uploading your work.