A simple tool to find and replace substring per line (that are should be way slower than sed), but way simpler to use for simple non-regex use cases.
requires Golang
go install github.com/kokizzu/replacer@latest 2021-08-22first version2023-03-25add 2 more flag:-untilsubstrand-untilprefixto replace only until specific substring or prefix2023-03-253rd parameter became substring search now, previously was prefix search, added 1 new flag:-afterprefix
./replacer [-afterprefix] [-untilsubstr UNTIL_TERM] [-untilprefix UNTIL_TERM] FROM_SUBSTR TO_SUBSTR AFTER_TERM file Must be in order
-afterprefixAFTER_TERM will become prefix search instead of default substring search-untilsubstr UNTIL_TERMwill replace only until UNTIL_TERM substring found-untilprefix UNTIL_TERMwill replace only until first UNTIL_TERM prefix found
$ echo 'a b c c d e afterThisLine a b c c d e' > a.txt $ replacer c ayaya afterThisTerm a.txt Done 2 replacement $ cat a.txt a b c c d e afterThisLine a b ayaya ayaya d e //go:generate replacer 'Id" form' 'Id,string" form' 'type Foo int' bla.go //go:generate replacer -afterprefix 'json:"id"' 'json:id,string" form' type bla.go //go:generate replacer 'By" form' 'By,string" form' 'type StructX' bla.go