Converting tab character file to a tab delimited file
2
0
Entering edit mode
2.4 years ago
munaj86 ▴ 30

Hi,,

I have a file that seems to have a tab character as a separator like this:

GL000194.1^I114018^I116018^IENSG00000277400.1^IENST00000613230.1^IE1^IE1^I0.391136256^I0.0895977^INULL^I0.120615^INULL GL000194.1^I114055^I116055^IENSG00000274847.1^IENST00000400754.4^IE1^IE1^I1.936254372^I0.0657418^INULL^I0.279872^INULL GL000218.1^I53893^I55893^IENSG00000278384.1^IENST00000612565.1^IE2^IE2^I1.736604295^I0.0191132^INULL^I0.0870197^INULL GL000219.1^I82311^I84311^IENSG00000273748.1^IENST00000612919.1^IE1^IE1^I0.289379317^I2.17428^IL^I2.65944^IL GL000250.2^I3146687^I3148687^IENSG00000226704.6^IENST00000426095.2^IE1^IE1^I0.318763031^I0.0460542^INULL^I0.0599142^INULL GL000250.2^I3159360^I3161360^IENSG00000232804.5^IENST00000450744.1^IE1^IE1^I1.075686604^I0.850952^INULL^I1.80465^IL GL000250.2^I4240731^I4242731^IENSG00000242092.8^IENST00000494878.5^IE1^IE1^I0^I1.58E-23^INULL^I0^INULL GL000250.2^I4240746^I4242746^IENSG00000242092.8^IENST00000489470.1^IE1^IE1^I0^I2.73E-25^INULL^I0^INULL

I want to convert this file to a tab delimited file. I've tried the following:

sed 's/ ^I/\t/g' infile > outfile cat infiletxt | tr -d '\t' > outfiletxt

Any suggestion please?

Thanks

Linux • 507 views
ADD COMMENT
0
Entering edit mode
2.4 years ago
Sej Modha 5.2k

You need an escape character to identify the special character ^

Try: sed 's/\^I/\t/g'

ADD COMMENT
0
Entering edit mode
2.4 years ago
ATpoint 76k
tr "^I" "\t" < file 

?

ADD COMMENT

Login before adding your answer.

Traffic: 3039 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6