#!/bin/bash # https://xed.ch/b/2016/1217.html cat <<"EOHD" EOHD awk ' function rc(){r=rand()*255;g=rand()*255;b=rand()*255;} BEGIN{srand(6);X=-90;Y=120;} { L[NR]=$1;S=S+$1; rc(); printf("\n", X,Y,r,g,b); #$1=""; printf("%s\n",X+30,Y+15,$0); Y+=25; } END{srand(6); R=100;PX=R;PY=0; #PROCINFO["sorted_in"]="@ind_num_asc"; #for(i in L){ # <--- See: http://xed.ch/blog/2016/1219.html for(i=1;i<=length(L);i++){ T+=L[i]/S; A=T*6.283185307; L[i]>S/2?B=1:B=0; X=R*cos(A);Y=R*sin(A); rc() printf("\n", PX,PY,B,X,Y,r,g,b); PX=X;PY=Y; } }' - echo ""