Hacker News new | ask | show | jobs
by rubyfan 25 days ago
I haven’t looked under the hood here but to make simple text replacement via command line is an LLM even required? A human driven command line tool to do basic substitution on batches of files reliably would be amazing.
4 comments

there is a python library for docx handling. my thinking was the use case for this was for larger scale automations / document processing.
you've never dealt with ooxml.
Sadly I have spent lots of time with ooxml and pdf and my experience suggests there really aren’t reliable means for dealing with seemingly simple changes.
sed, awk. docx is just zipped xml.
It is just zipped xml, but to do a search and replace while retaining document structure is very very complicated, and I’m struggling to think of how to combine sed and awk to achieve it.
Not really - if you wanna do a text replacement you can extract it yourself and do some work (or just use this CLI). The library is designed for longer workloads.