'How to find and replace string in a file WITHOUT sed [duplicate]
This is for my setup repo which I use in fresh linux installs and company provided macbooks. I have this makefile target:
omz-theme:
sed -i 's/ZSH_THEME=".*"/ZSH_THEME="$(THEME)"/g' $(HOME)/.zshrc
This works fine on linux but breaks on macs because they use BSD's sed. I need some way to find and replace text in my .zshrc that will run regardless of the system. Almost all resources online point only to sed.
Edit: This is how it "breaks" on mac. Doesn't happen if I do brew install gnu-sed and change the target to use gsed
sed: 1: "/Users/username/.zshrc": unterminated substitute pattern
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
