I am trying add a prefix variable(string) to command output.
sed parameter substitution is not working.
- I have found some issues on my end of testing,, please delete this thread for now.
I am trying add a prefix variable(string) to command output.
sed parameter substitution is not working.
You define a variable named prefix
. You expand a variable named myprefix
. Try:
prefix='myprefix'; echo "chr, aaaaa|bbbbbb" | sed "s/^/$prefix,/"
which produces the output:
myprefix,chr, aaaaa|bbbbbb