[comp.text] Printing envelopes from letters

fyl@fylz.UUCP (Phil Hughes) (05/02/89)

This really belongs in the "quickies" newsgroup but we don't have one so
here it is.

Since I bought an HP DeskJet, I am inclined to print envelopes directly
unstead of on a spearate printer with labels in it.  The common problem is
that I write a letter using troff and then need an envelope so I type in
the address again.  I finally wrote the following quick and dirty
solution.

What this script does is takes all lines follow a line that begins with .A
up until the next blank like and prints it on an envelope.  A return
address is also inserted.  The choice of .A should be ok with either mm
macros or no macros at all.  [NT]roff will just ignore this line.  Thus,
place the .A line before the address in the letter and the following
script will print all lines following the .A to the next blank line on an
envelope.

Enjoy.

-----------------------cut here-------------------------------

: pe
# print envelope - reading stuff after .A line in nroff file
awk '
BEGIN	{
	over = "                                   " # offset for address
	print ""
	# return address info follows
	print "Phil Hughes"
	print "8315 Lake City Way NE, #207"
	print "Seattle, WA 98115"
	printf "\n\n\n\n\n"
	}

$0 ~ /^$/ { pflag = 0}
	{ if (pflag == 1) print over $0}
/^.A/	{ pflag = 1}
    ' $1 | lp -dhp

-- 
Phil Hughes  -- FYL -- 8315 Lk City Wy NE -- Suite 207 -- Seattle, WA 98115
	
{uw-beaver!tikal,uunet!pilchuck}!ssc!fylz!fyl