The standard Unix utilities like lsof
and ps
produce output in a fixed width format with a header which should be easy to ingest programmatically.
Alas, the existing answers to How to efficiently parse fixed width files? require me to specify the column widths in advance instead of inferring then from the header line.
So, what is the right way to ingest the output of ps
and lsof
(and their ilk) into Python?