I have a file like this:
1 = zara
2 = gucci
I want to write a bash script which read two variables and decides to change the number in one of lines to a new number. I have this script for this purpose:
pattern="$num[[:space:]]=[[:space:]].*"
sed -ie 's,'"$pattern"','"$num"',\ =\ '"$newBrandName"',' $fileLocation
Variables num
, newBrandName
and fileLocation
have the right value; I have checked this by echo
command.
But when I run the script, I get this error:
sed: -e expression #1, char 52: unknown option to `s'
The output of echo
on the SED command is this:
sed -ie s,1[[:space:]]=[[:space:]].*,1\ =\ sign, /root/info.info
Can anyone help me with the regex?