#!/bin/bashstr='first , second ,, third, ,fourth suffix'sed -E 's/[[:space:]]*(([,[:space:]])[[:space:]]*)+/\2/g' <<< "$str"
Standard input is empty
first,second,third,fourth suffix
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!