garcimo has asked for the wisdom of the Perl Monks concerning the following question:
I need to scan about 190 servers for the presence of some users and output in csv in the following format:
hostname,user1,user2..userx
this snip of code grabs the desired lines from all the /etc/passwd but I do not know how to output the csv.... chomp (my @hosts = `cat ssh-list.txt`); #print "@hosts\n"; my (%ssh, %ls); for my $host (@hosts) { $ssh{$host} = Net::OpenSSH->new($host, user=> $user_name, password= +> $password,master_stderr_discard => 1, async=>1, master_opts => [-o => "StrictHostKeyChecking no" ] ); } for my $host (@hosts) { chomp (my $user = $ssh{$host}->capture('egrep "^dba|^sea|^adm|^mwa|^ae +" /etc/passwd'));
could I use getpwent to parse the output of $user?
I am rather new to perl so sorry if the code is bad.
|
|---|