Thread Mustersuche (18 answers)
Opened by la_dy82 at 2010-12-08 17:59

GwenDragon
 2010-12-08 18:39
#143410 #143410
User since
2005-01-17
14785 Artikel
Admin1
[Homepage]
user image
Ich nehme mal an, du willst einfach die Spalten addieren.

Test:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/perl

use strict;
use warnings;

my %summen = ();

while (my $zeile = <DATA>) {
  chomp($zeile);
  my @spalten = split (/\t/,$zeile);
  $summen{$_+1} += $spalten[$_] for 0..$#spalten;
}
print "Summen:\n";
print "$_: $summen{$_}\n" for sort keys %summen;

1;

__DATA__
1234    1       3       4       99.3    8       9.22
234     1       3       4       99.3    8       9.22
34      1       3       4       99.3    8       9.22
4       1       3       4       99.3    8       9.22
4       1       3       4       99.3    8       9.22


//EDIT: chomp hinzugefügt
Last edited: 2010-12-08 18:43:51 +0100 (CET)

View full thread Mustersuche