in reply to a dumb question
That script doesn't seem well thought out, if you're searching for 'tty1' it'll count lines with 'tty17' also. Depending on the format of the output of that aml_read command (minus the pipe to egrep), I might use perl's split function, so that I could do something like:for my $i ($TTYFIRST..$TTYLAST) { Tty_check($i,$start_ts,$end_ts,$selectedserver); }
my %ttys; for $line (`aml_read /l trace /h $_[3] /a commproc /s $_[1] /b $_[2] +/d all`) { # I'm making this split up, you'll have to post the # format of aml_read or figure out the split yourself my ($something, $tty, $stuff) = split " ", $line; $ttys{$tty}++; } for my $tty (sort { $a <=> $b} keys %ttys) { print "Count for $tty: $ttys{$_}\n"; }
|
|---|