I'm using this sed command to replace the string "##INFO=<ID="
with "\t%"
:
bcftools view -h /data/ExAC.r1.sites.vep.vcf | grep "^##INFO=<ID=" | sed $'/^##INFO=<ID=/{ s//'\t%INFO' /; s/,.*//; p; }''
but what I get is exactly my desired output, but instead of a backslash, it doesn't print anything. If I remove the single quotes around \t%INFO
in the sed command, it automatically tabs the output, so I don't want that either.
How can I escape the backslash so that it just prints a backslash?
1.)The dollar sign in front doesn't seem to have a point
2.)You cant just nest single quotes. I dont know how this "works" I wouldnt expect it to.
3.) This replaces the string with a tab then a %INFO. Then prints it. escape it once.
4.) This replaces the stinge with a \t%INFO then prints it, resulting in tab %INFO. Escape it again.
5.)This should work.
But there is an easier answer using a capture group. It looks like you are looking for this?
To get all on on line: