@Diego I had checked some possibilities by piping various subcommands of xsv, xan, csvkit etc. Then got a long awk snippet which was technically one line and it did work. However it took more 10-15 seconds on a large dataset.
On oneliner need, this is not for a one time use or a script. I want to set an alias to the solution and want to use it like less -S or cat or so on many files on a daily basis. Also I wanted to really reach a more efficient solution.
Many thanks to @Barmar, @Shawn, @jhnc and @dawg for the suggested solutions.
The perl based solution from @jhnc do meet the requirements I wanted help with. It is way quicker than the awk snippet I had (and shorter also).
@RARE, I can agree that the in/out example do look like a homework. Getting it done without getting into a R/python/shell script was the difficult part.