• 3 Posts
  • 525 Comments
Joined 11 months ago
cake
Cake day: June 23rd, 2024

help-circle


  • The issue is not only complexity, though it does play a role. You can also run into issues with pure text parsing, especially when whitespace is involved. The IP thing is a very classic example in my opinion, and while whitespace might not be an issue there (more common with filenames), the queries you find online in my opinion aren’t less complex.

    Normal CLI output is often meant to be consumed by humans, so the data presentation requirements are different. Then you find out that an assumption you made isn’t true (e.g. due to LANG indicating a non-English language) and suddenly your matching rules don’t fit.

    There are just a lot of pitfalls that can make things go subtly wrong, which is why parsing general CLI output that’s not intended to be parsed is often advised against. It doesn’t mean that it will go wrong.

    Regarding Python, I think it has a place when you do what I’d call data set processing, while what I talk about is shell plumbing. They can both use JSON, but the tools are probably not the same.




  • 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.


  • Laser@feddit.orgOPtoLinux@lemmy.worldStop Parsing (unstructured) Text
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    10 days 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.


  • Laser@feddit.orgOPtoLinux@lemmy.worldStop Parsing (unstructured) Text
    link
    fedilink
    English
    arrow-up
    4
    arrow-down
    1
    ·
    10 days 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.



  • Laser@feddit.orgOPtoLinux@lemmy.worldStop Parsing (unstructured) Text
    link
    fedilink
    English
    arrow-up
    2
    arrow-down
    2
    ·
    10 days 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.





  • For me, the factors were:

    • the ability to split your system configuration into logical modules. Describe one logical thing in one file, no matter how many other factors are involved. Don’t want that thing anymore? Just don’t reference the module, and all changes will be reverted.
    • easily try out new configurations and roll back, regardless of underlying filesystem, without performance penalties.
    • the ability to put logic into your configuration (technically, there’s no difference between what’s typically referred to as configuration and a module in nix, though the latter usually has more “logic” and provides values with lower priority).
    • as a consequence, make modules transferable between systems. There’s e.g. a Lanzaboote module that enables Secure Boot in a really smart way on NixOS, and the configuration is in my opinion easier than on any other Linux system.
    • the reproducibility, from which the “easy reinstallation” follows




  • That’s another win for the oat flakes, they don’t drive your blood sugar too high, but will keep it up for very long (no carb crash), plus they contain a load of micronutrients. Even their protein percentage is quite high - higher than chickpeas for example.

    Long story short, I don’t understand why people here are mad that the US government will no longer subsidize unhealthy and overpriced garbage. I know this probably isn’t where it’s going to stop, but at least this particular instance makes sense I guess.

    I’m not against did stamps being able to buy sweets. The issue I have is with a lot of breakfast cereals is that they too are in fact sweets, but people see them as a proper meal. They’re not. Occasional sweets are fine. Regularly eating a full meal consisting only of sweets is not.