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

Kusalananda
  • 333,661

1 Answers1

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:

Kusalananda
  • 333,661