Thread Menge bestimmter Einträge in einer Datei filtern (7 answers)
Opened by Rambo at 2009-08-11 11:18

topeg
 2009-08-11 11:54
#124102 #124102
User since
2006-07-10
2611 Artikel
BenutzerIn

user image
So kann man das machen:
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
24
25
26
#!/usr/bin/perl
use strict;
use warnings;

my %keys;

while(my $line=<DATA>)
{
  $keys{$1}++ if($line=~/,(.+?)$/);
}

while (my ($key,$val)= each(%keys))
{
  print "$key = $val\n";
}

__DATA__
Message = NPU$xy123/08Aug12344,ABS
Message = NPU$xy123/08Aug12344,ASR
Message = NPU$xy123/08Aug12344,ASR
Message = NPU$xy123/08Aug12344,ABS09
Message = NPU$xy123/08Aug12344,ACT12
Message = NPU$xy123/08Aug12344,ABS
Message = NPU$xy123/08Aug12344,ASR/88
Message = NPU$xy123/08Aug12344,ANTI
Message = NPU$xy123/08Aug12344,ANTI2

View full thread Menge bestimmter Einträge in einer Datei filtern