M.Be M.Be - 22 days ago 7
Linux Question

concat string in shell command line

I need some help to finalize a command line. I need to get a property name "server.port" in some files "applications.properties", and then make a curl on "myIp:server.port/health"

I get properties value with the following line, and the curl command get the param, but i can't add IP before and /health after.

Could you help me to finalize this command line ?

cat ms-something-*/application.properties | grep server.port | awk '{print $3}' | xargs curl


So without the last element "xargs curl", the line return a list of port number. but i need to add the ip (for example 8.8.8.8) and /health, to call curl on
"8.8.8.8:server.port/health"

Answer
cat ms-something-*/application.properties | grep server.port | awk '{print "8.8.8.8:"$3"/health"}' | xargs curl

should work for you, if I correctly understand your question...