• Home
  • About
    • William Hicks photo

      William Hicks

      Online home of William Hicks: poet, physicist, and software developer.

    • Learn More
    • Twitter
    • Github
    • StackOverflow
  • Posts
    • All Posts
    • All Tags
  • Projects

Counting Words in .odt files

10 Jul 2017

Rather frequently, I find myself wishing that there were an easy way to count the number of words in a .odt or .fodt file from command line. Most solutions I’ve come across make use of the (very handy) odt2txt tool, but this doesn’t play nice with .fodt files (at least with the version available in the Ubuntu 16.04 repos). So, I came up with a simple Python script that is a “good enough” solution for my use cases (though it may not be entirely robust). It’s available here in case it’s of use to anyone else. Working through it gave me a bit better understanding/appreciation of the .odt format and how it works. Tweaks welcome!



programmingpython Like Tweet +1