Re: Which tool for this report?



Cyrus Kriticos wrote:
Michael DeBusk wrote:
[...]

The last thing for me to do is get it to look like this:

Code Complete Incomplete
10445 1 0
10732 5 1
11468 5 0
10233 4 2

A solution with bash:
[...]

few changes:
- changed printf format and removed one if
- replaced variables $word and $i

--- cut here ---
#!/bin/bash

FILE="complete.dat"

read_file ()
{
while read code number; do
case $code in
Complete)
let c[$number]=c[$number]+1
;;
Incomplete)
let i[$number]=i[$number]+1
if [ -z "${c[number]}" ]; then c[$number]=0; fi
;;
esac
done < "$FILE"
}

dump_arrays ()
{
echo "Code Complete Incomplete"
for j in ${!c[@]}; do # yeah
printf "%5d %9d %11d\n" $j ${c[$j]} ${i[$j]}
done
}

read_file
dump_arrays
--- cut here ---

--
Best | "Was bekommt man/frau, wenn man/frau Software kauft?
regards | Nichts außer einem Haufen Nullen und Einsen."
Cyrus | -- aus d. Lizenzvereinbarung von Spybot Search&Destroy
.



Relevant Pages

  • Re: Which tool for this report?
    ... Cyrus Kriticos wrote: ... echo "Code Complete Incomplete" ... wenn man/frau Software kauft? ...
    (comp.unix.shell)
  • Re: Which tool for this report?
    ... Cyrus Kriticos wrote: ... while read word code; do ... echo "Code Complete Incomplete" ... wenn man/frau Software kauft? ...
    (comp.unix.shell)
  • Re: multiple pipes and tail -f
    ... On Aug 23, 1:34 am, Cyrus Kriticos ... wenn man/frau Software kauft? ... regards | Nichts außer einem Haufen Nullen und Einsen." ...
    (comp.unix.shell)
  • Re: grep: N Zeilen nach tring ausgeben
    ... On Aug 25, 1:38 pm, Cyrus Kriticos ... or post to de.comp.os.unix.shell in german ... Best | "Was bekommt man/frau, wenn man/frau Software kauft? ...
    (comp.unix.shell)
  • Re: Which tool for this report?
    ... Michael DeBusk wrote: ... echo "Code Complete Incomplete" ... wenn man/frau Software kauft? ... regards | Nichts außer einem Haufen Nullen und Einsen." ...
    (comp.unix.shell)