• marcos@lemmy.world
    link
    fedilink
    arrow-up
    16
    ·
    8 hours ago

    Somehow, despite being the standard it doesn’t come installed by default in any distro I’ve tried.

    They all insist you use sed… that bloated thing!

    • io@piefed.blahaj.zoneOP
      link
      fedilink
      English
      arrow-up
      4
      ·
      5 hours ago

      sed is a stream editor. A stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline). While in some ways similar to an editor which permits scripted edits (such as ed), sed works by making only one pass over the input(s), and is consequently more efficient. But it is sed’s ability to filter text in a pipeline which particularly distinguishes it from other types of editors.

      I love the way they are selling this

      https://www.gnu.org/software/sed/manual/sed.html

    • palordrolap@fedia.io
      link
      fedilink
      arrow-up
      2
      ·
      4 hours ago

      If your system has vi or a clone, try vi -e, or, if the symlink is set up, ex. Technically that’s vi in ex mode, not ed per-se but it’s about as similar as you’re going to get without a lot of pointless bother.

        • palordrolap@fedia.io
          link
          fedilink
          arrow-up
          2
          ·
          2 hours ago

          Comparison time!

          ex is to ed as nano is to pico

          That is, it’s an editor that works in almost exactly the same way as the original, but it’s by somebody else.

          ex is to vi as vi is to vim, or C to C++.

          That is, the latter grew out of and improved upon the former, but you can still use them like their forerunners if you really want, which is why vi has an ex mode and why you can still use pointers in C++ if you’re sufficiently warped.

    • wewbull@feddit.uk
      link
      fedilink
      English
      arrow-up
      12
      ·
      8 hours ago

      ed and sed arre different things. One edits files in place, interactively. The other edits streams i.e.batch processing.

      ed is the precursor to vi. Similar commands. It’s just you can only work on one line at a time.

      • marcos@lemmy.world
        link
        fedilink
        arrow-up
        7
        ·
        7 hours ago

        One edits files in place, interactively. The other edits streams i.e.batch processing.

        You want sed -i -f -

        ed is also the precursor of sed, and of some other dozen of commands.

        • wewbull@feddit.uk
          link
          fedilink
          English
          arrow-up
          2
          ·
          2 hours ago

          Yes ed begat sed, but sed works differently. It didn’t replace ed. It did a different job.

          Ed loads the file into a buffer which you edit in a random access fashion and then save. Sed collects a list of commands and then streams the file line by line, executing the commands as they match lines. In your example nothing happens until you’ve entered the whole editing script.