Name="Etiketten drucken" Stich="Etiketten drucken Drucken etiketten" Zeit="Die Oct 23 10:17:28 MEST 2001" Kurz="etiketten.pl kann aus CSV-Daten druckerfreundliche Etiketten machen. Ein bisschen Handarbeit wird aber trotzdem benötigt..." Lang=" Mein Skript etiketten.pl erzeugt aus einer CSV-Datei wie die folgende die weiter unten zu sehende Ausgabe: `exCodes daten.csv` Nachname;Vorname;Straße;PLZ;Ort Müller;Peter;Meierstr. 7;12345;Mayerstadt Schmidt;Franz;Schmidtweg 2;67891;Schmidten A;B;C;D;E F;G;H;I;J K;L;M;N;O P;Q;R;S;T `exCodee` `exCodes cat daten.csv \| ./etiketten.pl` `exCodee` Peter~Müller~~~~~~~~~~~~~~Franz~Schmidt~~~~~~~~~~~~~B~A\$ Meierstr.~7~~~~~~~~~~~~~~~Schmidtweg~2~~~~~~~~~~~~~~C\$ \$ 12345~Mayerstadt~~~~~~~~~~67891~Schmidten~~~~~~~~~~~D~E\$ \$ \$ \$ \$ \$ G~F~~~~~~~~~~~~~~~~~~~~~~~L~K~~~~~~~~~~~~~~~~~~~~~~~Q~P\$ H~~~~~~~~~~~~~~~~~~~~~~~~~M~~~~~~~~~~~~~~~~~~~~~~~~~R\$ \$ I~J~~~~~~~~~~~~~~~~~~~~~~~N~O~~~~~~~~~~~~~~~~~~~~~~~S~T\$ \$ \$ \$ \$ `exCodee` Damit man die Anordnung besser versteht, wurden alle Leerzeichen durch ~ und alle Zeilenenden durch \$ ersetzt.
Das Skript, Download: `exCodes etiketten.pl` #!/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@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@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); } `exCodee` Happy printing! " case $1 in Name) echo $Name; exit;; Stich) echo $Stich; exit;; Zeit) echo $Zeit; exit;; Kurz) echo $Kurz; exit;; Lang) echo $Lang; exit;; esac # if [ "$1" = "Name" ]; then echo $Name; fi mself_vA="txt/0037.txt txt/0058.txt txt/0067.txt"