• pete_the_cat@lemmy.world
    link
    fedilink
    English
    arrow-up
    24
    ·
    edit-2
    1 year ago

    It’s a way bigger pain in the ass than people think it is. I remember having to parse output from a tool for work that had tons of output in tabular format, mixed with normal sentence like strings. JSON, YAML, or XML outputs weren’t available so I had to do a nasty mess of grep, awk, cut, and head/tail, to get what I wanted. My first attempt was literally counting the characters so I could cut out exactly what I needed, but as we all know, hardcoding values is a recipe for headaches later on.

    • Jo Miran@lemmy.ml
      link
      fedilink
      English
      arrow-up
      30
      arrow-down
      1
      ·
      edit-2
      1 year ago

      Here’s a horror story from literally yesterday. We have been fighting a system for a client for weeks and it has been a nightmare. Our clients just told us that they outsourced some of their work to an Indian outfit but that outfit is unfamiliar with Linux and doesn’t know how to edit text files so they have been downloading the files to their Windows machines, editing them in Windows, then uploading the contaminated text files back into Linux. None of them, not our client nor the outfit they hired, understood why this was a problem. We have no idea what files are affected and we won’t know until they fail because they obviously did not keep track of what they touched.

      EDIT: I’m being intentionally vague.

      • PorkSoda@lemmy.world
        link
        fedilink
        English
        arrow-up
        14
        ·
        1 year ago

        Haha this is up there with having to explain why opening a csv in Excel and then saving means that I don’t want the file.

        • ramblinguy@sh.itjust.works
          link
          fedilink
          English
          arrow-up
          7
          ·
          1 year ago

          I will never forgive excel for automatically converting all of my dates to some weird ass format, or stripping single quotes randomly, or something other BS that they do for no reason

          • ddh@lemmy.sdf.org
            link
            fedilink
            English
            arrow-up
            2
            ·
            1 year ago

            My absolute favourite is stripping leading zeroes from any text that looks like a number, then displaying it in scientific notation. But we get Copilot, so it balances out, right?

        • Astaroth@lemm.ee
          link
          fedilink
          English
          arrow-up
          3
          ·
          edit-2
          1 year ago

          Does windows add an extra character at the end that gets converted to new line on linux? Because the other day I were copying a script and after pasting it an extra line was added after every single line, even the empty lines.

          how it looked when I copied it:

          bla
          bla
          
          bla
          

          what it turned into:

          bla
          
          bla
          
          
          
          bla
           
          
      • elscallr@lemmy.world
        link
        fedilink
        English
        arrow-up
        6
        ·
        1 year ago

        You can just grep for carriage returns followed by newlines, grep -Pirn '\r\n$' /path/to/whatever. It’ll identify all your problematic files.