Reputation: 672
I'm looking to get an argument inserted into a variable, sed currently pouting at me.
Turning this:
BASHVAR=" -Java.args -More.Java.Args -Even.More Java Args"
To this:
BASHVAR=" -Newly.added.Java.args -Java.args -More.Java.Args -Even.More Java Args"
I've tried matching and appending, but it adds newlines:
sed '/-Java.args/i -Newly.added.Java.args' /path-to-file
Resulting in:
-Newly.added.Java.args
BASHVAR=" -Java.args -More.Java.Args -Even.More Java Args"
Doesn't have to be sed, but would be nice use it.
Cheers
Upvotes: 0
Views: 97
Reputation: 241868
Use substitution instead of insertion
s/-Java.args/-Newly.added.Java.args &/
Upvotes: 3