| # 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} | |