Why not use something like IO::Pipe and get rid of awk completely. I suspect that the code below is 'not ideal' for example you very likely don't want/need a sub call to run_command I pass in system, protocol (rsh|ssh) and command in my case so it ate the sub call for some flexibility
#!/usr/bin/perl use strict; use warnings; use IO::Pipe; my @systems = ('3par-S400','3par-E200'); my $system = undef; my $output = undef; my $command = undef; foreach $system (@systems) { $output = run_command($system); while (<$output>) { next if (m/^$/); last if (m/^Press.*/) #grab bits here instead of using awk } close($output); } sub run_command { my $system = shift; my $protocol = 'ssh'; my $command = "statvv -ni"; my $space = " "; #The following is bad but it works for now.. my $do_command = $protocol . $space . $system . $space . $command; my $cmd = new IO::Pipe; $cmd->reader($do_command); return $cmd; }
In reply to Re: 3par data acquistion
by callmeavis
in thread 3par data acquistion
by bluethundr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |