How to convert tab separated file into comma separated file?


#1

Hi,

Could you please help me with converting the tab separated file into comma separated file?

Here is an example data in the file:


2.78	6379.23	20473.08	29.49
2.8	6540.2	20805.36	30.07
2.82	6688.92	20717.76	30.6
2.82	6730.9	20943.7	31.07
2.83	6677.63	21064.86	32.04
2.83	6541	20431.82	31.39
2.85	6674.44	20479.49	31.29
2.81	6603.74	20059.77	31.28
2.82	6584.3	19631.27	31.07
2.84	6637.84	19998.77	31.45
2.85	6824.63	20902.49	31.84
2.88	7154.8	21584.46	32.3
2.88	7192.52	21460.41	32.27
2.88	7270.92	22247.99	32.28
2.88	7230.49	22449.7	32.47
2.88	7230.49	22449.7	32.47

Thank you for your help.


#2

Hi,

for this you can use:

sed 's/	/,/g;'

this will convert it to CSV as:

2.83,6677.63,21064.86,32.04
2.83,6541,20431.82,31.39
2.85,6674.44,20479.49,31.29
2.81,6603.74,20059.77,31.28
2.82,6584.3,19631.27,31.07
2.84,6637.84,19998.77,31.45
2.85,6824.63,20902.49,31.84
2.88,7154.8,21584.46,32.3
2.88,7192.52,21460.41,32.27
2.88,7270.92,22247.99,32.28

Hope this helps…

Lubos


#3