How do I insert a newline in the replacement part of sed?
This code isn\'t working:
sed \"s/\\(1234\\)/\\n\\1/g\" input.txt > output.txt >
sed \"s/\\(1234\\)/\\n\\1/g\" input.txt > output.txt
Get a GNU sed.
$ brew install gnu-sed
Then your command will work as expected:
$ gsed "s/\(1234\)/\n\1/g" input.txt test 1234foo123bar 1234
nb: you may get GNU sed thanks to mac ports too.