I have a yml file
spring:
datasource:
url: url
username:test
password: testpwd
api:
security:
username:foo
password: foopwd
I want to update only the first occurrence or username and password using the command line on a Linux machine so that it looks like this:
spring:
datasource:
url: url
username:toto
password: totopsw
api:
security:
username:foo
password: foopwd
when i try :
sed -i -e 's!^\(\s*username:\)[^"]*!\1toto!' test.yml
he change all usernames