This is a test version of Biostars. For the public version, visit https://www.biostars.org.
sed or awk command
ENST00000448914.1   13  4.28456     0       0
ENST00000415118.1   8   3.52171     0       0

how to remove the (.*) from column 1 and it looks like

ENST00000448914 13  4.28456     0       0
ENST00000415118     8   3.52171     0       0

please tell me the sed command or awk command to remove it only .

rna-seq

3 answers

Hi harry,

By awk:

awk 'BEGIN{OFS="\t"} {gsub("\\.[0-9]+$", "", $1); print}'

(updated) For sed you can try:

sed -r 's/\.[0-9]+\t/\t/'

Hi harry

Please use the formatting bar (especially the code option) to present your post better. I've done it for you this time.
code_formatting

You could try sed like this

sed 's/\.1//'

This would only address .1s. We should account for .\d+, right?

If the gene is always on the first column:

sed 's/\.[0-9]\{1,\}//' yourfile.txt

should work

it will remove other (.) from other column.

It's weird because I try it and it don't remove the others (.) because I didn't put the 'g' global flag after the last slash

It might if the first . it encounters is not the transcript version. The awk solution, or yours modified to include an anchor and a first-word ensuring regex would be safe.

Log in to answer this question.