added
diff --git a/rearrange-idsDoc.awk b/rearrange-idsDoc.awk
new file mode 100644
index 0000000..e267553
--- /dev/null
+++ b/rearrange-idsDoc.awk
@@ -0,0 +1,14 @@
+# putting the end tag /</idsDoc> in the right place
+BEGIN                                                           {DOCCOUNT = 0;}
+
+$0 ~  "</idsDoc>"                                               {}
+$0 ~  "<idsDoc>"                                                {
+                                                                  if(DOCCOUNT++ > 0){
+								      print "  </idsDoc>";
+								    };
+								  print $0;
+                                                                }
+$0 ~  "</idsCorpus>"                                            {print "  </idsDoc>\n</idsCorpus>"}
+
+$0 !~ "</idsDoc>" && $0 !~ "</idsCorpus>" && $0 !~ "<idsDoc>"   {print}
+