0

On a running a customised kubectl command in bash terminal, it opens a yaml file in the vim editor, but i'm trying to replace a string without having to open an editor. (command is part of a bash script.)

kubectl deploy apps edit namespace | sed  -i "s/version-tag:2.4.0.9/version-tag:2.4.0.10/"

Error:

sed: no input files
Vim: Warning: Output is not to a terminal


    kubectl deploy apps edit namespace | sed  -i -e "s/version-tag:2.4.0.9/version-tag:2.4.0.10/"

Error:
sed: -e expression #1, char 1: unknown command: `-' and no replacement happens.

I tried other options, by referring the suggestions on the forums, no luck though.. Where am I going wrong.

Goku
  • 482
  • 1
  • 7
  • 22

1 Answers1

0

Remove the -i in the sed command. This should work:

kubectl deploy apps edit namespace | sed "s/version-tag:2.4.0.9/version-tag:2.4.0.10/"
JoseLinares
  • 775
  • 5
  • 15
  • 1
    Forgot to add that, tried that as well - but it opens a vim editor which I dont want, as I have to run this command as part of the shell script. – Goku Mar 11 '21 at 13:50