# 8 -> 2*4 --> 4*3 = 12 cat $1 | sed 's/^ \([^ ]\)/ \1/g' > $1.tmp # 6=3*2 --> 3*3=9 cat $1.tmp | sed 's/^ \([^ ]\)/ \1/g' > $1.tmp2 # 4=2*2 --> 2*3=6 cat $1.tmp2 | sed 's/^ \([^ ]\)/ \1/g' > $1.tmp # 2=1*2 --> 1*3=3 cat $1.tmp | sed 's/^ \([^ ]\)/ \1/g' > $1.tmp2 echo done: $1.tmp2