In this post, I go into hopefully better output parsing.

    • @[email protected]
      link
      fedilink
      English
      12 months ago

      You can run powershell on Linux! This is the one thing I like about powershell: everything’s an object under the hood.

    • @[email protected]OP
      link
      fedilink
      English
      02 months ago

      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.

      • JWBananas
        link
        fedilink
        English
        32 months ago

        But those don’t really help you on machines that don’t have those installed.

        Meanwhile the article assumes jq is present, which it hasn’t been by default on any of my servers.

        Off I go down the structured data shells for Linux rabbit hole!

        • @[email protected]OP
          link
          fedilink
          English
          32 months ago

          Maybe I should have written it differently: I think people are rather willing to install another tool than a whole new shell. The later would also require you to fundamentally change your scripts, because that’s most often where you need that carefully extracted data. Otherwise manually copying and pasting would suffice.

          I was thinking about writing a post about nu as well. But I wasn’t sure that appeals to many, or is it should be part of something like a collection of stuff I like, together with fish as an example of a more traditional shell.

          • chonkyninja
            link
            fedilink
            English
            02 months ago

            Maybe you should just learn the toolsets better. Structured looks great until you’re tasked either with parsing a 20GB structured file. Each line of text representing a single item in a collection makes total sense, then when you get into things like a list subtype there’s nothing stopping you from using a char sequence to indicate a child item.

            • @[email protected]OP
              link
              fedilink
              English
              42 months ago

              One might wonder if at those file sizes, working with text still makes sense. I think there’s a good reason journald uses a binary format for storing all that data. And “real” databases tend to scale better than text files in a filesystem as well, even though a filesystem is a database.

              Most people won’t have to deal with that amount of text based data ever.

  • @[email protected]
    link
    fedilink
    English
    6
    edit-2
    2 months ago

    Isn’t it incredible, that we have to read blogposts to learn how to extract an IP addr of a network interface in the shell … in json … in 2025 ??!

    Some problems will never really get solved.

    Thanks for the write up !

    • @[email protected]OP
      link
      fedilink
      English
      2
      edit-2
      2 months ago

      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.

      • @[email protected]
        link
        fedilink
        English
        2
        edit-2
        2 months ago

        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