I want to replace all occurrences of {{password}} or {{ password }} or {{password }} in files with some string using sed
i am able to remove with know number of spaces, but could not remove all combinations.
i could replace using, but not all combinations
sed -i -e "s/{{ password }}/$password/g" test.sql
If the number of spaces is arbitrary, then you could search for zero or more spaces ( *
) instead of just one space ( ) with something like
{{ *password *}}
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.