skip to Main Content

Replace same occurrence of word with different words using sed – CentOS

I want to replace 2 same words in file(app.properties) with 2 different words using sed command. Example: mysql.host=<<CHANGE_ME>> mysql.username=testuser mysql.port=3306 mysql.db.password=<<CHANGE_ME>> required output will be mysql.host=localhost mysql.username=testuser mysql.port=3306 mysql.db.password=password123 I tried below command: sed -e "s/<<CHANGE_ME>>/localhost/1" -e "s/<<CHANGE_ME>>/password123/2" app.properties >…

VIEW QUESTION
Back To Top
Search