Issue
The title says all. i need to replace a property value whom i don't know to a different value. i'm trying this:
#!/bin/bash
sed -i "s/myprop=[^ ]*/myprop=$newvalue/g" file.properties
i get sed: -e expression #1, char 19: unknown option to
s'`
I think the problem is that $newvalue
is a string that represents a directory so it messes up sed.
What can I do ?
Solution
sed
can use characters other than /
as the delimiter, even though /
is the most common. When dealing with things like pathnames, it's often helpful to use something like pipe (|
) instead.
Answered By - Dan Fego Answer Checked By - Mildred Charles (WPSolving Admin)