Created
March 2, 2014 13:25
-
-
Save mehikmat/9306522 to your computer and use it in GitHub Desktop.
Bash script to find and replace texts inside a file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
............... | |
.................. | |
#### Function to find and replace a text inside file using bash | |
updateLateCommandURLInPreseedFile(){ | |
echo "[INFO]:: Updating late command url in pressed.cfg file**************" | |
echo "" | |
cat preseed.cfg | sed 's_${IPADDR}_'"$IP"'_g' > temp.cfg | |
cat temp.cfg > preseed.cfg | |
rm temp.cfg | |
echo "[INFO]:: Successfully substituted IP address of late command server****************" | |
} | |
#### Calling function | |
updateLateCommandURLInPreseedFile | |
................ | |
.................. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment