awk '{ l=length($0) f=l%3 for (i=1;i<=l;i++){ printf substr($0,i,1) if((i-f)%3==0 && i!=l) printf "," } print "" }' nowcoder.txt