I’m trying to replace a line of text in a properties file.
For example:
food.type=banana
With this line of code I can replace banana entirely with another entered input.
FOOD=apple
sed "s/food.type=.*/food.type=$FOOD/"
Output:
food.type=apple
However when the previous line of text I’m trying to replace has a / in it, I can’t get the replacement to work.
For example:
food.type=/yellow/banana
Any help is much appreciated. Thanks!
The slashes are being read as closing the reg-ex match/substitute patterns,
Do
Some seds require that you escape the first instance of a non-standard delimiter, ie
I hope this helps.