I'm doing the following sed
sed -i {/comment : "Blabla" ;/a leakage_power_unit : "1nW";} $file
After the line "comment : "Blabla" ;"
I want to add "leakage_power_unit : "1nW""
but I want to add some spaces before the string. The result should be " leakage_power_unit : "1nW""
but sed is ignoring whitespaces.
I have an alternative which is using the substitute command but the solution is not pretty and this way above is cleaner and more understandable.
So my question is how can I add the spaces with /a
?
sed -i {/comment : "Blabla" ;/a leakage_power_unit : "1nW";} $file
Including empty spaces after "/a" doesn't work
sed -i {s/comment : "Blabla" ;/comment : "Blabla" ;\n leakage_power_unit : "1nW";/g} $file
works but the expression can be confusion for others.