35 ms·
Unix tools on newline delineated list like objects work great, but try them on dict like objects and it becomes clunky really fast. Parsing `ip` output is a goo
by Spivak 3y ago
Unix tools on newline delineated list like objects work great, but try them on dict like objects and it becomes clunky really fast. Parsing `ip` output is a good example where the data naturally lends itself to iface:attrs. Plucking the value you want by `.[.name | startswith('eth')].addr` is way easier than pulling this out with grep/awk.
- BenjiWiebe 3y agoYou probably already know this but just in case: You can specify an interface when using ip, e.g. ip addr show dev enp2s0