Lgalan90
Lgalan90

Reputation: 615

sed command between quotes

Here is what I am trying to run the command against:

tags:
  - "environment:qa4"

I'm using the following command:

sed -e "s,"environment:[^/,"]*/,"environment:qa1,"" test.yaml

But it cuts off the closing quote:

tags:
  - "environment:qa1

I will be transferring this command over to Jenkins once i get it to work on the command line. How can I get it to pick the closing quote?

Thanks!

Upvotes: 1

Views: 37

Answers (1)

Quasímodo
Quasímodo

Reputation: 4004

You mean

sed -e 's,"environment:[^"]*","environment:qa1",' test.yaml

Notice that the outer quotes were changed to single-quotes, so that the double-quotes inside the pattern and substitution string are correctly interpreted literally.

Upvotes: 2

Related Questions