- https://en.wikibooks.org/wiki/XML_-_Managing_Data_Exchange/OpenOffice.org_%26_OpenDocument_Format
- https://github.com/JochenHayek/misc/blob/master/using_timestamps_in_filenames/create_snapshot_from_ODF.sh
- https://en.wikipedia.org/wiki/XMLStarlet
Your “.odt” (or “.ods”) file is a ZIP file with a meta.xml inside:
$ unzip -l YOUR.ods … … meta.xml …
This is a convenient way to extract meta.xml to STDOUT:
$ unzip -p YOUR.ods meta.xml …
This is how to get the XML reformatted using xmlstartlet:
$ unzip -p YOUR.ods meta.xml | xml fo
This command line shows you the possible XPath expressions:
$ unzip -p YOUR.ods meta.xml | xml el … office:document-meta/office:meta/dc:date …
How to extract “modified” to STDOUT?
$ unzip -p YOUR.ods meta.xml | xml sel --template --value-of office:document-meta/office:meta/dc:date
And how to extract the timestamp w/o anything but decimal digits?
$ unzip -p YOUR.ods meta.xml | xml sel --template --value-of office:document-meta/office:meta/dc:date | tr -d ':TZ-' | perl -pe 's/^(.*)..*$/$1/'
…
Leave a Reply