Input file:
ID_REF,GSM2819484,GSM2819485,GSM2819486,GSM2819487,GSM2819488,GSM2819489,GSM2819490,GSM2819491,GSM2819492,GSM2819493
My code:
awk -F, '{$1="";print substr($0,2)}’ | tr ' ' '\n' > result
tr is the one giving the issue. How can I use tr in a pipeline?
Expected output:
GSM2819484
GSM2819485
GSM2819486
GSM2819487
GSM2819488
GSM2819489
GSM2819490
GSM2819491
GSM2819492
GSM2819493
It looks simpler to just use tr
from the get go and then filter the first line using tail
like this:
echo "ID_REF,GSM2819484,GSM2819485,GSM2819486,GSM2819487,GSM2819488,GSM2819489,GSM2819490,GSM2819491,GSM2819492,GSM2819493" | tr ',' '\n' | tail -n+2
But as far as I can tell, there is nothing wrong with your command except the ’
at the end of the awk command should be an '
.
awk -F, '{$1="";print substr($0,2)}’ | tr ' ' '\n' > result
^ this should be '
With the correct character there your command also works for me!