I'm using sed to modify a file. In simple terms, my modifier looks as so

sed -e '11s/$/ $LinuxUsername/'

This is suppose to add in their linux username at the end of line 11, however, it is instead posting the actual variable name "$LinuxUsername" at the end of line 11. How can i make it post the actual value of the variable?

I've tried using quotes and double quotes in different parts of the expression, but still failed to get it to work properly.

Currently, line 11 is looking like the following...

  john.doe william.mcmillion jonny.doeboy $LinuxUsername $LinuxUsername


The following is correct. Error was found further upstream.

sed -e "11s/$/ $LinuxUsername/"

marked as duplicate by Jeff Schaller, ilkkachu, Kusalananda linux Jun 20 '18 at 14:06

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Browse other questions tagged or ask your own question.