in reply to Re: Store and print multiple strings
in thread Store and print multiple strings
Hi, I'm capturing the string using (.\d+\.\d+) with the . matching the ~ since that is only present if the values are 0.00. If they were 51.11 for example, there would be no ~ but would still match as there's spaces after Util before the actual digit. Might be a better way to do that?
My values are just printed to screen and are held in $text:
my $text = $host->cmd("monitor lag $lag_traffic interval 3 repeat 3 ra +te | match Totals post-lines 1");
$lag_traffic is just derived from another input that is held in @lag_id:
my $lags = $host->cmd("show lag description"); my @lag_id = ( $lags =~ m/(\d+)\Se\S/g );
For a guess, you're pretty spot on. Essentially what I want is to have the following displayed:
LAG ID 200:
1 - Input - x Output - x
2 - Input - x Output - x
3 - Input - x Output - x
LAG ID 199:
1 - Input - x Output - x
2 - Input - x Output - x
3 - Input - x Output - x
Your recommendation solves why it was just counting the contents, so thank you. Given I know the first value in the text is always input and the second is always output, would it be easier to split them up before or after putting them in the key?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Store and print multiple strings
by AnomalousMonk (Archbishop) on Mar 12, 2018 at 15:02 UTC | |
|
Re^3: Store and print multiple strings
by roboticus (Chancellor) on Mar 12, 2018 at 15:36 UTC |