1

I have seen StackOverflow answers on this question, but I am struggling to see how they apply to my problem because my special characters are escaped and adding a command to the end of the sed call does not resolve the problem.

The command syntax I'm using is as follows :

sed -i `date +%s` -E 's/^#?master:/master:\n  - serverone\n  - servertwo/' /etc/salt/minion

As mentioned, I have already tried adding a command to the end (e.g. g) but that has no effect and the same error is presented.

I am using GNU sed 4.7 on Debian 10

  • Spot on ! Thank you @steeldriver – Little Code Jan 11 at 11:12
3

When wanting to use a backup suffix with GNU sed, the suffix must following the -i option immediately, as in

sed -i"$( date +.%s )" -E '...as in question...' /etc/salt/minion

I've also added a dot to the backup suffix so that you get suffixes like .1578741576.

Related:

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.