reportwriter - sample report program
SYNOPSIS
DESCRIPTION
reportwriter
is a sample shell program that produces a sample standard report.
It uses
splittable
to divide the table into page-sized tables.
While it is useful for illustrating
several tricks for using UNIX shell programming and
/rdb
tools, a much better way to generate reports is with the
report
command.
SOURCE
#!/bin/sh
# reportwriter: Copyright 1993 Schaffer & Wright
# %W% SCCS Information
# reportwriter is a sample shell script to write standard reports.
# it uses splittable to break up the table and adds headers
# and footers.
USAGE='usage: reportwriter'
TABLE=report$$
# you can edit this number to fit your page between header and footer
NUMBER=-50
# the next two lines gets todays date
set `date`
DATE="$3 $2 $6"
# edit the next line to start on a different page number
PAGE=1
# preprocess the data in the table
column Price Company City < /usr/rdb/demo/unixtable |\\
sorttable -n |\\
total -l Price |\\
justify > $TABLE
# split table into page sized tables
splittable $NUMBER $TABLE
# loop printing each page from header, splittable and footer
for I in $TABLE[a-z][a-z]
do
echo "
Prices of Computers that ran UNIX(TM) in 1983
From Urban Software of New York City
Report Date: $DATE
"
cat $I
echo "
Page $PAGE
\
"
PAGE=`expr $PAGE + 1`
done
# be sure to remove the split tables
rm $TABLE $TABLE[a-z][a-z]
SEE ALSO