I am trying to use sed to remove a piece of code from a yaml file. what I have so far is the below code, but it does not work.
sed -i 's/- node-service\/velocity_log_deployment((.|\n)*)//' config.yml
the code that I want to remove is:
- terraform/init_and_plan:
name: terraform_plan
context:
- phdv-docker-hub-creds
- phdv-aws
terraform_version: <<pipeline.parameters.terraform_version>>
working_directory: ~/project/infra
persist_to_workspace_filepath_prefix: infra/
requires:
- package
# remove start
- node-service/velocity_log_deployment:
name: velocity_log_deployment
repository_url: https://github.com/pizzahutuk/lambda-contentful-menu-sync
requires:
- terraform_apply
context:
- phdv-docker-hub-creds
- phdv-aws
# remove end
- terraform/init_and_apply:
name: terraform_apply
context:
- phdv-docker-hub-creds
- phdv-aws
terraform_version: <<pipeline.parameters.terraform_version>>
working_directory: ~/project/infra
requires:
- terraform_plan
filters:
branches:
only: main
result after sed replace:
- terraform/init_and_plan:
name: terraform_plan
context:
- phdv-docker-hub-creds
- phdv-aws
terraform_version: <<pipeline.parameters.terraform_version>>
working_directory: ~/project/infra
persist_to_workspace_filepath_prefix: infra/
requires:
- package
- terraform/init_and_apply:
name: terraform_apply
context:
- phdv-docker-hub-creds
- phdv-aws
terraform_version: <<pipeline.parameters.terraform_version>>
working_directory: ~/project/infra
requires:
- terraform_plan
filters:
branches:
only: main