Use of ``vi'' for business office word-processing

Larry Campbell campbell at maynard.UUCP
Wed Sep 17 12:42:16 AEST 1986


In article <6902 at ki4pv.UUCP> tanner at ki4pv.UUCP (who else) writes:
>The reason that our customers have gone to "lyrix" instead of using
>what we use for \fBall\fR of our document preparation is simple:
>our customers need to print form letters &c. to their customers.
>
>There appears to be no easy or clean way to merge data into nroff --
>the data would have to be prepared with extra new-lines, and as for
>iterating to print a hundred copies -- looks like it would be hairy.

Funny, I whipped off a little shell script to do just that today.
Something like this (typed from memory, it was on a different system,
so I may have dropped a backslash or a quote somewhere):

	#!/bin/sh
	# Run this with the data file (address list, whatever)
	# as standard input
	#
	while 1
	do
		read NAME
		if [ "$NAME" = "" ]; then exit; fi
		read ADRRESS
		read CITY_STATE_ZIP
		sed <form.letter \
			-e "s/<<NAME>>/$NAME/" \
			-e "s/<<ADDRESS>>/$ADDRESS/" \
			-e "s/<<CITY_STATE_ZIP>>/$CITY_STATE_ZIP/ \
		    | nroff -ms >/dev/lp
	done

Improving this to handle variable number of lines in an address,
salutations, etc. is left as an exercise for the reader.  This isn't
super fast, but then again nroff is where most of the time is spent
anyway.
-- 
Larry Campbell                             The Boston Software Works, Inc.
ARPA: campbell%maynard.uucp at harvard.ARPA   120 Fulton Street, Boston MA 02109
UUCP: {alliant,wjh12}!maynard!campbell     (617) 367-6846



More information about the Comp.unix mailing list