for scripting within bash look at
http://www.tldp.org/LDP/abs/html/index.html
`lp` or `lpr` sends print requests to print spooler probably you want to install a2ps, ghostscript and so on, if you don't know how to write postscript
some useful commands for scripting
`head`, `tail`, `read`, `echo` ...
an example using html (for web standarts look at w3c.org), you could use xml and use `xsltproc` to convert it to html, maybe you want use redirections (pipes) - for faster execution
#!/bin/sh
file_in=()
file_out=()
file_ps=()
file_head=()
file_tail=()
wc_out=()
byte_count=()
byte_count_stop=()
current_matrix_row=()
sign0=()
sign1=()
function matrix_row{
current_matrix_row=`printf "<tr><td>%s</td><td>%s</td></tr>" $sign0 $sign1`
}
file_in=`read -p "read from file: "`
file_out=`read -p "write to file: "`
file_ps=`read -p "postscript file name: "`
file_head="<html><head></head><body><table>"
wc_out=`wc -c`
byte_count_stop=`expr match $wc_out "[0-9]*."`
[ byte_count_stop-1 ]
byte_count_stop=$?
byte_count=${wc_out:0:$byte_count_stop}
file_tail="</table></body></html>"
echo -e "$file_head\n" > $file_out
# here you may write some special code
echo -e "$file_tail\n" > $file_out
html2ps $file_out -o $file_ps
lp $file_ps