Printing addresses

Ingo Blechschmidt iblech at web.de
Tue Oct 23 01:29:52 PDT 2001


On Mon, Oct 22, 2001 at 02:20:32PM +0200, Jan Stifter wrote:
> On Sat, 10 Jun 2000 03:59:48 +0200, Ingo Blechschmidt <iblech at web.de>
> wrote:
> 
> >On Sun, Oct 21, 2001 at 11:16:46PM +0200, Jan Stifter wrote:
> >> After searching freshmeat without success: I am looking for a program to 
> >> manage my addresses (not email-adresses) and to be able to print them in a 
> >> format I can specify:
> >> 
> >> adr1    adr2      adr3
> >> adr4    adr5      adr6
> >> ....
> >> adr19  adr20     adr21
> >> 
> >> on each page.
> >> 
> >> Can anybody give me a hint, how to do this?
> >> 
> >> Jan
> >> -- 
> >> Unsubscribe: send email to listar at linuxfromscratch.org
> >> and put 'unsubscribe blfs-support' in the subject header of the message
> >
> >Try to program this in Perl. My friend wrote it and it
> >worked well.
> 
> Ok, then, well, can you ask your friend to give it to the community?
> :-)
> 
> Cheers Jan
> 
> -- 
> Unsubscribe: send email to listar at linuxfromscratch.org
> and put 'unsubscribe blfs-support' in the subject header of the message

Here is the script, mail any suggestions or bugs to iblech at web.de.

#!/usr/bin/perl
# etiketten.pl - Formats CSV to printer-friendly etticets (German: Etiketten).
# Copyright (C) Die Okt 23 09:57:42 MEST 2001 - now by Ingo Blechschmidt.
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# Ingo Blechschmidt
# Arberstraße 5
# 86179 Augsburg
# E-Mail: iblech at web.de, http://www.way.to/uselinux/
# Tel.: +49 / 821 882955
#
# 

# The reason why no `-w' or `use warnings' is used is, that the script reads in
# 3-line-steps the input CSV file (via STDIN). There would be many warnings by
# the Perl interpreter.

$HEADER = 1;		# If set to 0 the first line of the input is NOT
			# ignored.
$FAMNAME = 0;		# Column number of the Family Name (counted from 0).
$FIRSTNAME = 1;		#    "      "    " the First Name.
$STREET = 2;		#    "      "    " Street.
$PLZ = 3;		#    "      "    " PLZ. Note: I'm not sure how the PLZ
			# in America is called. Probably Postcode or ZIP Code.
			# Please send mail to iblech at web.de. Thanks!
$CITY = 4;		# Column number of the City/Town.
$t = '';		# Temporary variable.
$DELI = 9;		# Number of rows of each entry.

<STDIN> unless ($HEADER == 0);

while(not eof) {
  chomp($t = <STDIN>); @l1 = split(";", $t);
  chomp($t = <STDIN>); @l2 = split(";", $t);
  chomp($t = <STDIN>); @l3 = split(";", $t);
  print "$l1[$FIRSTNAME] $l1[$FAMNAME]", ' ' x (25 - (length($l1[$FIRSTNAME]) + length($l1[$FAMNAME]))), "$l2[$FIRSTNAME] $l2[$FAMNAME]", ' ' x (25 - (length($l2[$FIRSTNAME]) + length($l2[$FAMNAME]))), "$l3[$FIRSTNAME] $l3[$FAMNAME]\n";
  print "$l1[$STREET]", " " x (26 - length($l1[$STREET])), "$l2[$STREET]", " " x (26 - length($l2[$STREET])), "$l3[$STREET]\n";
  print "\n";
  print "$l1[$PLZ] $l1[$CITY]", ' ' x (25 - (length($l1[$PLZ]) + length($l1[$CITY]))), "$l2[$PLZ] $l2[$CITY]", ' ' x (25 - (length($l2[$PLZ]) + length($l2[$CITY]))), "$l3[$PLZ] $l3[$CITY]\n";
  print "\n" x ($DELI - 4);
}



-- 
Written by Ingo Blechschmidt, iblech at web.de or +49 / 821 882955.  .~.
Time sharing - the use of many people by the computer.            /V\
See http://linide.sourceforge.net/. Registered Linuxer #232173,  /( )\
registered Linux machine #111789, see http://counter.li.org/.    ^`~'^

-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe blfs-support' in the subject header of the message



More information about the blfs-support mailing list