set 2024 07
CERRAG=tmp/CERRAG
REPEMIT=tmp/REPEMIT
pcc=tmp/pcc
agecc=tmp/agecc
prest=tmp/prest
ihmq pacie h00^ d00^ d01^ h20^00|awk -F^ ' ant!=$1 { j=0; ant=$1}
{
printf "%s%.2d^%s\n",$1,j++,$2
} ' > $prest
ihmq pacie h00^ h01^ h02^ h04^ | awk -F^ ' 
function trail(txt) { while (substr(txt,length(txt),1)==" ") txt=substr(txt,1,length(txt)-1); return (txt) }
{ print $1"^"$2"^"trail($4)" "trail($3) } ' >$pcc
ihmq agend h01^ h02^$2/$1 h03^ H04^ h05^$2/$1 h06^C h00^ h08^ h07^| tee tmp/agecc |
awk -F^ ' FILENAME==ARGV[1] { pac[$1]=$2;pacn[$1]=$3;next}
{
printf "%12.12s%12.12s%s%2.2s^%s\n",$4,pac[substr($1,1,5)],substr($5,7)"-"substr($5,4,2)"-"substr($5,1,2),$3,$7" "$8" "substr($4,14)" "pacn[substr($1,1,5)]
} ' $pcc - | sort >$CERRAG
ls RPZ | egrep $1-$2 |sort >$REPEMIT

awk -F^ ' FILENAME==ARGV[1] { age[$1]=$1; fol[$1]=$2;ag[$1]++}
 FILENAME==ARGV[2] { rep[$0]=$0;rp[$0]++ }
{rrg[$1]++}
END {
#for (i in rrg) if(rrg[i]<2) if(rp[i]) printf "RPZ/%-40s\n",rep[i]
#for (i in rrg) if(rrg[i]<2) if(ag[i]) printf "%-40s %s\n",age[i],fol[i]
for (i in rrg) if(rrg[i]<2) printf "RPZ/%-40s %s %s\n",rep[i],age[i],""
} ' $CERRAG $REPEMIT  >/dev/null
profs=./tmp/profs
appl/sh/profs > $profs

awk -F^ 'FILENAME == ARGV[1] { prest[$1]=$2 ; next }
FILENAME==ARGV[2] { pac[$1]=trail($3);next }
FILENAME==ARGV[3] { prfs[$1]=trail($2);next }
function trail(txt) { while (substr(txt,length(txt),1)==" ") txt=substr(txt,1,length(txt)-1); return (txt) }
{
pacc=substr($1,1,5)
valo=prest[sprintf("%s%2.2s",pacc,$3)]
datt=substr($5,7)"-"substr($5,4,2)"-"substr($5,1,2)
print "PREST="$3,substr($3,1,2),prfs[substr($3,1,2)],valo
printf "%s^%s^%s^%s^%s^",trail($9),prfs[valo],trail($8),pac[pacc],datt


printf "%12.12s+%5.5s+%s+%2.2s+%2.2s+21+C\n",$4,$1,datt,valo,$3
} ' $prest $pcc $profs $agecc
