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 bcbs_build.txt.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 isbcbs9.0.00.01_134143 I came up with a sed command that worked for pulling the values I wantedsed -n -e '/Build_Version=/p' -e '/docker_Name=/p' environment-info.conf > build_version.txtbut this extracts the Build_Version= and 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).
How to extract data from a file and construct a filename from one of the values
bash;text processing;sed;string
That file looks like sh syntax. So, if that file is indeed a configuration file intended to be sourced in sh scripts, just do:. ./environment-info.conf &&  printf '%s\n' ${docker_Name%%-*} $Build_Version > ${docker_Name%%-*}_build.txt