#!/bin/sh

# disable filename globbing

wget --no-check-certificate http://buin.homelinux.com/cgi-bin/EXC/impu
BAS=`pwd`
cd ..
BASE=`pwd`
APPLDIR=$BASE/appl
DATADIR=$BASE/data
PATH=$PATH:$BASE/ihd/bin:.
export PATH APPLDIR DATADIR
ihdm factu h05 h08 | awk ' { print $1"^"$2 } ' |
awk -F"^" ' FILENAME == ARGV[1] { cta[$1]=$2; next }
$2!=52 {
for (i =1;i<NF;i++) if(i==8) printf "H%.2d%s\n",i,cta[$5] >"impu/H/"$5$1
else printf "H%.2d%s\n",i,$i >"impu/H/"$5$1
print "\n" >"impu/H/"$5$1
} ' - $BAS/impu
for i in $BAS/H/*
do
./ihd/bin/ihmu factu $i -N1

done
rm -f $BAS/H/* $BAS/impu
