libipfix: specify the number of the wprobe ie append script on the command line

SVN-Revision: 18855
This commit is contained in:
Felix Fietkau 2009-12-19 22:19:34 +00:00
parent 2caa29bc44
commit 93f368cb23

View file

@ -6,16 +6,12 @@ my @fields = (
[ "_ss", "UINT", " - Sum of squared samples", 8 ], [ "_ss", "UINT", " - Sum of squared samples", 8 ],
); );
my $file = $ARGV[0] or die "Syntax: $0 <file>\n"; my $file = $ARGV[0] or die "Syntax: $0 <file> <start>\n";
-f $file or die "File not found\n"; -f $file or die "File not found\n";
my $last_ie = 0; my $start = $ARGV[1];
my $line; $start =~ /^\d+$/ or die "Invalid start number";
open IES, "<$file" or die "Can't open file"; open FILE, "<$file" or die "Can't open file";
while ($line = <IES>) { while (<FILE>) {
$line =~ /^(\d+)\s*,/ and $last_ie = $1;
}
close IES;
while (<STDIN>) {
/^(%?)(\w+),\s*(\w+),\s*(.+)$/ and do { /^(%?)(\w+),\s*(\w+),\s*(.+)$/ and do {
my $counter = $1; my $counter = $1;
my $rfield = $2; my $rfield = $2;
@ -28,7 +24,7 @@ while (<STDIN>) {
@f = @fields; @f = @fields;
} }
foreach my $f (@f) { foreach my $f (@f) {
my $nr = ++$last_ie; my $nr = $start++;
my $n = $f->[0]; my $n = $f->[0];
my $N = uc $n; my $N = uc $n;
my $ftype = $f->[1]; my $ftype = $f->[1];
@ -38,4 +34,5 @@ while (<STDIN>) {
} }
}; };
} }
close FILE;