Parsing with CSV: Unify lines and result.

col1;col2;col3;col4 A;1;4;5 A;3;4; A;1;4; # New output: col1;col2;col3;col4 A;1(2x);3;4(3x);5 any ideas?

Input

col1;col2;col3;col4
A;1;4;5
A;3;4;
A;1;4;

Output

col1;col2;col3;col4
A;1(2x);3;4(3x);5