old value: 10.125.11.5:27017 -u username -p password
new value: 10.125.19.6:27017
I want to replace all the old value in *.py files (current directory folder and subdirectory) using shell,how to do?
seems sed or grep can not work with’-u’ or ‘-p’.
Advertisement
Answer
Suppose you have an inputfile with this content:
$ cat inputfile 10.125.11.5:27017 -u username -p password
After executing this:
$ sed -e "s,10.125.11.5:27017 -u username -p password,10.125.19.6:27017,g" -i inputfile
You get this input file:
$ cat inputfile 10.125.19.6:27017
That should help with your issue.