groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] Address labels]


From: Benn Newman
Subject: Re: [Groff] Address labels]
Date: Fri, 18 Aug 2006 12:41:33 -0500
User-agent: Thunderbird 1.5.0.5 (Windows/20060719)

M Bianchi wrote:
> On Fri, Aug 18, 2006 at 09:34:07AM +0100, John Poltorak wrote:
>> How would one populate this with addresses from, say an ASCII CSV file
>> which had one line per address?
>
>    I don't use CSV files, so I don't have anything in hand.
I don't either. Addresses have commas in it, so I use tabs.

I use this awk script to make each entry into srtrings.
# Copyright © 2006 Benjamin T. D. Newman
#Last,First,Middle,Prefix,Suffix,Address,Donations,Comments
BEGIN   { FS = "\t" }
                { print ".ds La " $1 }
                { print ".ds Fi " $2 }
                { print ".ds Mi " $3 }
                { print ".ds Pr " $4 }
                { print ".ds Su " $5 }
                { print ".ds A1 " $6 }
                { print ".ds A2 " $7 }
                { print ".ds Do " $8 }
END             { print ".nr Lt 1" }
                { printf "\n" }

Which is piped into troff

\" Copyright © 2006 Benjamin T. D. Newman
.if \n(Lt .ex
.rd
.de label
.nf
\*(Pr \*(Fi \*(Mi \*(La \*(Su
\*(A1
\*(A2
..
.Label avery5160
.Fill label \1+(co \1+(ro 1
.if !\n(Lt .nx addresses.labels

gawk -f addresses.awk addresses.tsv | groff -mlabels addresses.labels > addresses.labels.ps

One problem that I have seen is that it does the last entry twice. It also does that with the accompanying letter template that I use with that.

Hope this helps.
--
Benn Newman
http://www.tip9ug.jp/who/newmanbe/

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]