suppose I have a file:
its format should be :
number, string1 , [string2] ,….
here string1 should not contain ‘,’ ,because we use ‘,’ to separate each column
but due to some reason ,string1 now contain some ‘,’ inside it,
so we need to replace it with other symbol ,such as ‘-‘
1,aaa,bbb,ccc,[x,y,z],eee,fff,ggg
2,q,w,[x],f,g
3,z,[y],g,h
4,zzz,xxx,ccc,vvv,[z],g,h
....
should be revised to :
1,aaa-bbb-ccc,[x,y,z],eee,fff,ggg
2,q-w,[x],f,g
3,z,[y],g,h
4,zzz-xxx-ccc-vvv,[z],g,h
....
what’s the best way to do it without programming , I mean we just use awk,sed,vim rather than shell programming,python,c++,etc
Thanks
Let’s break out the awk script for easier commenting.