sed insert line with spaces to a specific line
You only need one \
to input multiple blanks
like this
sed -i "${line} i \ ${text}" $file
You can escape the space
character, for example to add 2 spaces:
sed -i "${line} i \ \ ${text}" $file
Or you can do it in the definition of your text
variable:
text="\ \ hello world"