sed to replace / between the two numbers

i Have a file as following

view    pz19a0c0/1000T_J_3MoDw9DSLh1ZsCubdua-LKOQmbtiVgkIsiMbSiwF467?sessionId=15451401994597121249
view    pz19a0c0/100086X67pR0MwzWnhhSO6sAEoxeFMyhh-IIbUCCdxicaQM4FC9?sessionId=154514019945971212494898
view/cart       pz19a0c0/100086X67pR0MwzWnhhSO6sAEoxeFMyhh-IIbUCCdxicaQM4FC9?sessionId=15451401994597121249

i need to replace slash with tab between the numbers

ex output:

view    pz19a0c0	1000T_J_3MoDw9DSLh1ZsCubdua-LKOQmbtiVgkIsiMbSiwF467?sessionId=15451401994597121249
view    pz19a0c0	100086X67pR0MwzWnhhSO6sAEoxeFMyhh-IIbUCCdxicaQM4FC9?sessionId=154514019945971212494898
view/cart       pz19a0c0	100086X67pR0MwzWnhhSO6sAEoxeFMyhh-IIbUCCdxicaQM4FC9?sessionId=15451401994597121249

can some help me on this.

Any attempts / ideas from your side ?

Regards
Peasant.

1 Like

You need to try and write your own code at unix.com.

You have 28 posts here.

Surely you can try to write a one line of sed code? (code not working as you expect is OK and encouraged)

i tried this ..this is not working for me...1

sed 's/\[0-9]*\/\([0-9]\)*/\t/g'

You're close. Try

sed -r 's/([0-9])\/([0-9])/\1\t\2/' file
view    pz19a0c0    1000T_J_3MoDw9DSLh1ZsCubdua-LKOQmbtiVgkIsiMbSiwF467?sessionId=15451401994597121249
view    pz19a0c0    100086X67pR0MwzWnhhSO6sAEoxeFMyhh-IIbUCCdxicaQM4FC9?sessionId=154514019945971212494898
view/cart       pz19a0c0    100086X67pR0MwzWnhhSO6sAEoxeFMyhh-IIbUCCdxicaQM4FC9?sessionId=15451401994597121249
1 Like

Thanks Rudic