in reply to parse /etc/passwd and output it as csv in hundred servers
Hi, you could solve this in perl alone but this is also a practical use for parallel-ssh with a snip of perl to make your report.
apt install pssh parallel-ssh -h HOSTNAMES_TXT -o /tmp/users 'cut -d: -f1 /etc/passwd' perl -le ' for my $file (@ARGV) { my ($host) = $file =~ m{/([^/]+)$}; open my($fh), $file or die "Error opening $file: $!"; my @users = <$fh>; chomp @users; print join(",", $host, @users) . "\n"; } ' /tmp/users/*
⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊
In Section
Seekers of Perl Wisdom