sed - remove spaces before 1rst occurence of string

seems easy but havent found in other posts...

i want to delete any spaces if found before first occurence of ${AI_RUN}

sed 's/ *\\$\\{AI_RUN\\}/\\$\\{AI_RUN\\}/' $HOME/temp1.dat

i think i'm close but can't put my finger on it. :rolleyes:

What's it doing or not doing?

Assuming you mean a literal ${AI_RUN}, and not the value of the variable:

sed 's/ *${AI_RUN}/${AI_RUN}/' "$HOME/temp1.dat"

it made no changes to my file. i still ended up with spaces before the ${AI_RUN}

Hummm thank you muchly...

i thought to search for the literal $ and { i would have to use the escape character \

i'm missing something in my understanding.....

thanks for the clarification...:slight_smile:

Inside single quotes, everything is literal.

Thanks again for that clarification. i'll get it straight one day :cool: