Ejection by bk1e

BEGIN{FS=_}
{t=v=$0;gsub(/[DRU]/," ",t);gsub(/[^R]/,"",v);r[NR]=t v
for(i=1;i<=NF;++i){
if($i=="D")++d[i]
if($i=="U")++u[i]}}
function f(a,b,r){m=0
for(i=1;i<=NF;++i)if(m<a[i])m=a[i]
for(j=0;j<m;++j){
s=""
for(i=1;i<=NF;++i)s=s ((r?(m-j-1):j)<a[i]?b:" ")
sub(/ *$/,"",s)
print s}}
END{f(u,"U",1)
for(i=1;i<=NR;++i)print r[i]
f(d,"D",0)}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page