0
target_id       tpm     tpm     tpm     tpm     tpm     tpm     tpm     tpm     tpm     tpm     tpm
PB.1.1|1:6643-11779(-)|transcript/55100 9207.33 13266.4 15244.3 2844.27 2708.52 2731.91 3193.83 2675.78 3413.74 4001.   37      3332.62
PB.2.1|1:11961-16372(+)|transcript/24543        14.2016 27.8457 29.6335 7.14533 7.34512 7.64953 8.71118 6.87958 7.228   98      6.3592  5.94422
PB.2.2|1:11961-16373(+)|transcript/30117        2.70221 2.74091 2.81943 3.99669 2.69497 2.82466 3.01701 2.62054 2.958   49      2.48024 2.44429
PB.2.3|1:11962-16374(+)|transcript/35082        1.21596 1.76974 2.24733 1.76356 2.05692 1.7765  1.65524 1.44116 1.970   26      2.16288 1.50391
PB.3.1|1:27833-34327(+)|transcript/44399        71.0007 131.61  145.062 24.9771 23.0295 24.9615 26.8033 20.4961 25.36   6       26.6337 21.9282
PB.4.1|1:39316-44582(-)|transcript/24897        26.5017 37.3793 43.4624 11.1199 8.80527 8.18072 12.612  10.0202 12.24   37      8.06654 7.04677
PB.4.2|1:39317-44595(-)|transcript/39771        9.23018 9.89149 7.58203 10.1779 8.67577 7.9611  8.5775  9.83895 7.638   42      6.40913 6.58653
PB.4.3|1:39318-43423(-)|transcript/29985        20.8149 20.6359 14.5622 3.89209 3.92182 3.4396  4.53606 2.6505  3.979   53      2.92956 2.63565
PB.5.1|1:44841-49854(-)|transcript/24019        36.302  19.7211 18.3107 71.1272 70.6337 65.391  62.6371 61.8226 67.62   43      55.2076 57.7828

So I want to remove after the first | up to the first decimal numbers. For example I want this outputted:

PB.1.1| 9207.33 13266.4 15244.3 2844.27 2708.52 2731.91 3193.83 2675.78 3413.74 4001.   37      3332.62.

I've tried using the cut command but have only been able to cut everything after the first delimiter, any pointers?

3 Answers 3

0

A simple solution would be to use awk and specify | as your field separator.

awk 'BEGIN {FS="|"} ; {print $1"|"$3}'

This would print the first and third fields. So for your example I get:

PB.1.1|transcript/55100 9207.33 13266.4 15244.3 2844.27 2708.52 2731.91 3193.83 2675.78 3413.74 4001.   37      3332.62
PB.2.1|transcript/24543        14.2016 27.8457 29.6335 7.14533 7.34512 7.64953 8.71118 6.87958 7.228   98      6.3592  5.94422
PB.2.2|transcript/30117        2.70221 2.74091 2.81943 3.99669 2.69497 2.82466 3.01701 2.62054 2.958   49      2.48024 2.44429
PB.2.3|transcript/35082        1.21596 1.76974 2.24733 1.76356 2.05692 1.7765  1.65524 1.44116 1.970   26      2.16288 1.50391
PB.3.1|transcript/44399        71.0007 131.61  145.062 24.9771 23.0295 24.9615 26.8033 20.4961 25.36   6       26.6337 21.9282
PB.4.1|transcript/24897        26.5017 37.3793 43.4624 11.1199 8.80527 8.18072 12.612  10.0202 12.24   37      8.06654 7.04677
PB.4.2|transcript/39771        9.23018 9.89149 7.58203 10.1779 8.67577 7.9611  8.5775  9.83895 7.638   42      6.40913 6.58653
PB.4.3|transcript/29985        20.8149 20.6359 14.5622 3.89209 3.92182 3.4396  4.53606 2.6505  3.979   53      2.92956 2.63565
PB.5.1|transcript/24019        36.302  19.7211 18.3107 71.1272 70.6337 65.391  62.6371 61.8226 67.62   43      55.2076 57.7828
0

sed -e 's/|.\{33\}//w test2.txt' test.txt This worked alright, thanks everyone regardless.

0

Tested with Below command and worked fine

command

sed 's/|.*|transcript\/[0-9]\{5\} /| /g'  filename

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.