I'm trying to pull two values from a configuration file and write them to a new file. The hard part is that I want the name of the new file to be determined by one of the values in the input file.
The values I'm trying to pull are "Build_Version" and the four-letter acronym from the Docker name ("docker_Name"). For example, if the file says
docker_Name='bcbs_pr-app-01', I want only the "bcbs". And I want to write them to a file with the build's name, such as
Here is an excerpt from the log file:
nonSSL_port=80 # FOR STAGING Build_Type=prod Build_Version=9.0.00.01_134143 docker_Name='bcbs-pr-app-01'
The desired file output is
I came up with a
sed command that worked for pulling the values I wanted
sed -n -e '/Build_Version=/p' -e '/docker_Name=/p' environment-info.conf > build_version.txt
but this extracts the
docker_Name= lines in their entirety, and I want only the Build_Version and docker name values.
And I still need to figure out how to name the file with the four-letter Docker name acronym (bcbs).