bash command sed is outputting an unexpected error -


i'm trying replace word in file using sed. in same bash script use command :

sed -i "s/${list[$index]}/${phone}/g" $1 

and it's working flawlessly on first function, second function wrote:

sed -i "s/${list[$index]}/${zipcode}/g" $1 

outputs error:

sed: -e expression #1, char 0: no previous regular expression 

i'm desperate, i'm pretty sure it's dumb mistake i'm doing can't sort out

when first half of sed substitute command empty:

sed 's//foo/' <<< bar 

it returns error:

sed: -e expression #1, char 0: no previous regular expression 

therefore, as william pursell commented, there's value of ${list[@]} array that's empty, or maybe $index out of array's range.


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -