perl -e 'map{chomp;$a[$i<3?$i:($i=0)].=$_;$i++}<>;print"@a\n";' filea fileb filec