I have a text file in which there's a YAML formatted code. Here's the code:
trigger:
branches:
include:
- develop
- release/*
- rapid/*
- Sprint/*
- Unity/*
Now, I have a bash script through which I want to add a string after this string; " - develop". Here's the point I want to maintain the spacing format. Here;s my bash file code.
$target_string= " - develop"
$replacment_string=" - TerraformTest/*"
sed -i "/$target_string/a$replacment_string" test.txt
But the result I got it this:
trigger:
branches:
include:
- develop
- TerraformTest/*
- release/*
- rapid/*
- Sprint/*
- Unity/*
Is there any way, I can put tab in sed command to obtain the output like this:
trigger:
branches:
include:
- develop
- TerraformTest/*
- release/*
- rapid/*
- Sprint/*
- Unity/*