I have a block content in my ~/.ssh/config. begin with a line '# BEGIN AUTO GENERATED CONTENT' and end with a line '# END AUTO GENERATED CONTENT'
I have a command replacing content between this two lines, with the content reading from a file named 'config'
sed -i -ne '/# BEGIN AUTO GENERATED CONTENT/ {p; r config' -e ':a; n; /# END AUTO GENERATED CONTENT/ {p; b}; ba}; p' ~/.ssh/config
it works well in ubuntu, but it cannot work in my mac which use bsd sed. it gave out this error message:
sed: 1: "/# BEGIN AUTO GENERATED ...": unexpected EOF (pending }'s)
I need to correct this command to work in bsd. not using gsed in mac
sed
script is supposed to do and show the (relevant) contents of~/.ssh/config
.-e '...'
with unbalanced braces? Can you combine this to one script? Maybe GNU sed somehow combines all to one script while other implementations handle them separately.