I have a requirement to identify and write all xml file names which are empty to a text file for reporting purpose. Empty , here means the xml file has the usual header tag <?xml version="1.0" encoding="UTF-8"?> followed by an empty open and close tag.
Sample file: 1)
<?xml version="1.0" encoding="UTF-8"?>
<STBTests>
</STBTests>
2)
<?xml version="1.0" encoding="UTF-8"?>
<UMTTests>
</UMTTests>
There are no data in the xml files apart from this. Any suggestions on how to approach this would be great.
find /path -size -128cto find files with less than 128 bytesfor F in *.xml; do if [ $(wc -l "$F") -lt 4 ]; then echo "$F"; fi; done<foo>xxxxxxxxxxxxxxxxxxxxxxxx</foo>