Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • very simple and sweet, didn't thought about printf can run the show :) Commented Sep 10, 2019 at 15:53
  • 2
    ed sucks with very large files. Commented Sep 10, 2019 at 15:58
  • ... because it reads the whole file into a buffer in memory before operating on it. Commented Sep 10, 2019 at 16:20
  • 2
    @Ed, I suppose it depends on the implementation, but at least GNU ed, while it reads the file fully, doesn't store it whole in memory (probably only records the offsets of each line within the file which explains why it's more efficient at dealing with longer lines). It does create a temporary copy of the file though. Commented Sep 10, 2019 at 16:58