Or don’t, I’m not your father.
The situation Sometimes, you want to get a very specific part of a command output. The classic problem is to get the IP address of an interface. Even today, the results to these queries on your favorite search engine will most likely involve grep, sed, awk and the like...
In this post, I go into hopefully better output parsing.
Linux also has some shells working on structured data (e.g. nu and elvish). But those don't really help you on machines that don't have those installed.
In general, I think Powershell's approach is better than the traditional one, but I really dislike the general commands. Always feels weird using it.
You're welcome! And actually, even this approach can yield surprising results... As in have you heard of deprecated IPv6 addresses before? Well I hadn't until I realized my interface now had one (it actually didn't anymore when I wrote the post, I used the jq command on old output, not in a pipe). Which made my DynDNS script stop working because there was now a line break in the request URL that curl rightfully failed on.
Edit: also despite what the title of the post says, in not an authoritative expert on the matter and you can use whatever works for you. I see these posts more as a basis for discussions like here than definitive guides to do something the correct way.
As in have you heard of deprecated IPv6 addresses before?
Definetly not 0.o
It's really hard to actually believe that a problem like this hasn't got a 1-word-command + flag solution yet. I mean you could ecxpect something like
ip -6 -i eno0
or so...
And yes, totally agree on the edit part! It's always nice to at least no about all the options that exist and smb found out hustling the same struggle like me :D