8181 is dynamic value. port="$1" grep -rl 8080 /tmp/standalone.xml | xargs sed -i 's/8080/"$port"/g' It will replace 8080 with "$port" not with the inputs
This is one where you have the correct tool for the job, and the question is "How do I use it?". Basic substitution is covered in a cursory fashion in the man page, but there are literally 100's of good sed tutorials/examples on the web. This is a valid question, but it is borderline between getting dinged for not doing due-diligence before asking the question. No downvotes, but be aware, stackoverflow, as a programming site, really encourages you to look before you ask. Just guidance for the future -- Welcome to SO
sed "s/8080/$port/g", this way the$portwill be expanded to its actual value.sedtutorials/examples on the web. This is a valid question, but it is borderline between getting dinged for not doing due-diligence before asking the question. No downvotes, but be aware, stackoverflow, as a programming site, really encourages you to look before you ask. Just guidance for the future -- Welcome to SO/tmp/standalone.xmla folder?