Show HN: Simple multiline find and replace with sed

(replace.sh)

14 points | by cwaffles 1471 days ago

2 comments

  • cwaffles 1471 days ago
    Hi HN,

    I've made a website for generating sed scripts with Rust and Typescript+React. Built this in a week to learn Rust with GraphQL and Diesel, and a bit of front end with React. Feedback is much appreciated.

    Github: https://github.com/esemeniuc/replace.sh/

    • yyx 1471 days ago
      The example is not really helpful because you can do it with

        sed s/findo/replaco/g
      • cwaffles 1471 days ago
        That's true, I've considered that but I haven't found an example that is as easy to scan for quick demos.
  • level3 1471 days ago
    It looks like you're not escaping single quotes in the find pattern, so the command output gets malformed.

    Also, you're reading in the whole file before replacing, even though most uses of sed will probably be per line. Including an option for line-by-line (maybe as default) would be much better for large files.