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

Re: Sequentielle Liste in Tabelle verwandeln



* Andre Tann [30-10-2009 12:07]:

> > Wie soll das genau aussehen?
> 
> Vereinfacht:
> 
> Name	Str.	Ort	Tel	Fax	Mail
> ============================================
> Name1	Str1	Ort1		Fax1
> Name2	Str2	Ort2			Mail2
> Name3	Str3	Ort3	Tel3	Fax3	Mail3

Das ist mal ein Ansatz:

#!/usr/bin/perl
my %h = ();
my $i = 1;
while (<>) {
    chomp;
    if ( $i > 0 && $i < 4 ) {
        $h{$i} = $_;
    } else {
        if ( /(.*):\s(.*)/ ) { $h{$1} = $2; }
    }
    $i++;
    if ( /^$/ ) {
        print "$h{'1'} $h{'2'} $h{'3'} $h{'Tel'} $h{'Fax'} $h{'Internet'}\n";
        $i = 1;
        %hash = ();
    }
}
# eof

Schön machen musst du es alleine. :-)

Gruß Uwe

Attachment: signature.asc
Description: Digital signature


Reply to: