I have the below line in a file:
~Test1~, ~Test2~,,,, ~Test3, Test4~, ~Test5~
This should be interpreted 7 columns as the comma between ~Test3 and Test4~ is data, not a delimiter.
I want to have a dynamic script in unix that will check the number of columns (7) based on the field delimiter, in this case ',' and to ignore that in one column exists a text with comma. The separator can be replaced during the process.
I think a solution in sed would be to change the separator from comma into a semicolon ';' which would make the output: ~Test1~; ~Test2~;;;;~Test3, Test4~; ~Test5