Replace space by tAB

My file looks like

3 33 210.01.10.0 2.1 1211 560 26 45 1298 98763451112 15412323499 INPUT OK
3 233 40.01.10.0 2.1 1451 780 54 99 1876 78787878784 15423210199 CANCEL OK

Aim is to replace the spaces in each line by tab
Used:

sed -e 's/  */\t/g'

But I get output like this

3	33	210.01.10.0	2.1	1211	560	26	45	1298	98763451112	15412323499	INPUT	OK  3	233	40.01.10.0	2.1	1451	780	54	99	1876	78787878784	15423210199	CANCEL	OK

instead of

3	33	210.01.10.0	2.1	1211	560	26	45	1298	98763451112	15412323499	INPUT	OK
3	233	40.01.10.0	2.1	1451	780	54	99	1876	78787878784	15423210199	CANCEL	OK

Is there something I am missing?

I am getting the latter output with GNU sed:

$ gsed -e 's/  */\t/g' file
3	33	210.01.10.0	2.1	1211	560	26	45	1298	98763451112	15412323499	INPUT	OK
3	233	40.01.10.0	2.1	1451	780	54	99	1876	78787878784	15423210199	CANCEL	OK

Can you post the output of

od -bc file

?

Hi,

I get the desired output as Scrutinizer said in gnu sed.

minor point , for given input lines contains only one space so following is sufficient.

sed 's/ /\t/g' file

However following one do not prevent to have a desired output.

sed 's/  */\t/g' file

This regex covers more ie., looks for one space then zero or more space characters.

Or

tr -s ' ' '    ' <file
3	33	210.01.10.0	2.1	1211	560	26	45	1298	98763451112	15412323499	INPUT	OK
3	233	40.01.10.0	2.1	1451	780	54	99	1876	78787878784	15423210199	CANCEL	OK