• Chris
    link
    fedilink
    118 days ago

    D i think. A and C aren’t using capture groups right afaict.

    • @[email protected]
      link
      fedilink
      58 days ago

      I don’t see anything wrong with the capture groups in A and C. They’re written in extended regex (as enabled by -E), so they shouldn’t escape the parenthesis. Am I missing something?

      • Chris
        link
        fedilink
        28 days ago

        Oh maybe you are right, I never use extended regexes for no reason

  • @[email protected]
    link
    fedilink
    108 days ago

    Which one of these commands is correct?

    A: sed -E 's/\b(\w+)\b/echo \1 | rev/g' file.txt
    B: sed 's/\b\w+\b/echo & | rev/ge' file.txt
    C: sed -E 's/(\w+)/$(echo \1 | rev)/g' file.txt
    D: sed 's/\([a-zA-Z]\+\)/\n&\n/g; s/\n\(.*\)\n/\3\2\1/g; s/\n//g' file.txt

    Chatty was so kind to transcribe. May contain errors.

    • @[email protected]
      link
      fedilink
      78 days ago

      Chatty claims the correct answer to be:

      Spoiler

      B

      I tried it my self and I conclude:

      Spoiler

      none is correct.

  • 👍Maximum Derek👍
    link
    fedilink
    English
    88 days ago

    The first language I was fluent in was Perl so PCRE is second nature to me. But then everyone decided they wanted their own regex dialects. And now there’s a PCRE2? Why 2? Stay with 1, you’re good together. What about the kids?

  • @[email protected]
    link
    fedilink
    0
    edit-2
    8 days ago

    Yo ill be 100 with you.

    Regex is where something like an LLM excells.

    Don’t rely on an llm for coding, but… This is exactly where it should be in your toolbox.

    • circuitfarmer
      link
      fedilink
      88 days ago

      I don’t disagree with this hot take. But the major difference is the sheer resources needed to have an LLM in place of a “do one thing right” utility like sed. In that sense, they are incomparable.

      • @[email protected]
        link
        fedilink
        38 days ago

        I think they’re arguing for having the LLM generate the regex. And I certainly would not trust an LLM to do that right.

        • NatanoxOP
          link
          fedilink
          English
          48 days ago

          Yeah, it’s way more sensible to use some of the available regex utilities like this. Although it’s always funny to see what an LLM comes up with.

      • @[email protected]
        link
        fedilink
        2
        edit-2
        7 days ago

        I mean fair.

        I guess the caveat here should be fucking learn regex first, lmao.

        Don’t use it works not necessary. Google is probably still better if you’re looking for regex for an email or something like that

        And also don’t just rely on its answer for prod.

      • @[email protected]
        link
        fedilink
        3
        edit-2
        8 days ago

        A lot of lemmy is very anti-Ai. As an artist I’m very anti-Ai. As a veteran developer I’m very pro AI (with important caveats). I see it’s value; I see it’s threat.

        I know I’m not in good company when I talk about its value on Lemmy.

        • NatanoxOP
          link
          fedilink
          English
          28 days ago

          Completely with you on this one. It’s awful when used to generate “art”, but once you’ve learned its short-comings and never blindly trust it it is such a phenomenal help in learning and assisting with code or finding something you’ve a hard time to find the right words for. And aside from generative use-cases neural networks are also phenomenally useful for assisting tasks in science, medicine and so on.

          It’s just unfortunate we’re still in the “find out” phase of the information age. It’s like with the industrialization ~200 years ago, just with data… and unfortunately the lessons seem to be equally rough. All the generative tech will deal painful blows to our culture.

          • @[email protected]
            link
            fedilink
            18 days ago

            That’s a view from the perspective of utility, yeah. The downvotes here are likely also from a ethics standpoint, since most LLMs currently trained are doing so by using other peoples’ work without permission, all while using large amounts of water for cooling, and energy from our mostly coal-powered grid. This is also not mentioning the physical and emotional labor that many untrained workers are required to do when sifting through the datasets of these LLMs, removing unsavory data for extremely low wages.

            A smaller, more specialized LLM could likely perform this same functionality with a much less training, on a more exclusive data set (probably only a couple of terabytes at its largest I’d wager), and would likely be small enough to run on most users’ computers after training. That’d be the more ethical version of this use case.

        • @[email protected]
          link
          fedilink
          1
          edit-2
          8 days ago

          I think it’s important to also use the more specific term here: LLM. We’ve been creating AI automation for years for ourselves, the difference now is that software vendors are adding LLMs to the mix now.

          I’ve hear this argument before in other instances. Ghidra, for example, just had an LLM pipeline rigged up by LaurieWired to take care of the more tedious process of renaming various functions during reverse engineering. It’s not the end of the analysis process during reverse engineering, it just takes out a large amount of busy work. I don’t know about the use-case you described but it sounds similar. It also seems feasible that you could train an AI system on your own system (given you have enough reversed engineered programs) and then run it locally to do this kind of work, which is a far cry from the disturbingly large LLMs that are guzzling massive amounts of data and energy to learn and run.

          EDIT: To be clear, because LaurieWired’s pipeline still relies on normal LLMs which are unethically trained, her pipeline using it is also unethical. It has the potential to be ethical, but currently is unethical.

  • @[email protected]
    link
    fedilink
    -38 days ago

    I some beef with this meme in that there really isn’t a way to simply do this in windows. If anything, it demonstrates the upper level of capability and function using a cli shell. People who are looking for a windows replacement would never need to understand this command or even use a pipe / regex as they were unlikely to have been doing this kind of thing with windows anyway.

    • missingno
      link
      fedilink
      128 days ago

      Who said anything about Windows? What’s that have to do with the meme?

    • Justin
      link
      fedilink
      18 days ago

      who in their right mind would try to do this on Linux