bash/awk equivalent code to gnu datamash