Please, just use perl already.  Here's something to get started.  At
least it reliably parses the file without the sed grep nonsense.


#!/usr/bin/perl -w
use strict;

my $fp;
open $fp, "/etc/group" or die "poop";

while (<$fp>) {
        chomp;
        my ($gname, $gpass, $gid, $dudes) = split /:/;
        my @users = split /,/, $dudes;
        print "$gname has @users in it\n";
}
close $fp;

Reply via email to