I have a file with many rows as below. I just want to extract columns 2,3,5,6; but the third column without the 'chr' prefix:


585     ENST00000417324 chr1    -       34553   36081   36081   36081   3  


ENST00000417324 1 34553 36081

I would use awk as the task is very simple, but I don't know how to get rid of the 'chr' prefix.

Thank you!

1 Answer 1


You could substitute chr at the beginning of the third field with an empty string:

awk '{ sub(/^chr/,"",$3); print $2,$3,$5,$6 }' file

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .