• Badabinski@kbin.earth
    link
    fedilink
    arrow-up
    2
    ·
    18 hours ago

    I was waiting for someone to come along with this response lmao

    I’m terrible at remembering shell string operation syntax, but this is the ultimate answer.

    • sik0fewl@lemmy.ca
      link
      fedilink
      arrow-up
      2
      arrow-down
      1
      ·
      15 hours ago

      Definitely not the ultimate, since it’s not POSIX, but still a nice tidbit.

      • Badabinski@kbin.earth
        link
        fedilink
        arrow-up
        3
        ·
        15 hours ago

        Idk, writing POSIX-compliant shell is so miserable that I avoid doing it when I can. You can use Bash on BSD and all other unixes, so it’s still a relatively portable solution.

        • sik0fewl@lemmy.ca
          link
          fedilink
          arrow-up
          2
          arrow-down
          1
          ·
          15 hours ago

          True enough, but it’s pretty much the same to use sed, unless you need those milliseconds of performance boost.