Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Re: 2048 character limit

by druid (Initiate)
on Jun 06, 2002 at 08:15 UTC ( [id://172105]=note: print w/replies, xml ) Need Help??


in reply to Re: 2048 character limit
in thread 2048 character limit

#!/usr/bin/perl -w open (FILE,"/home/druid/group"); open (FILE2,">/home/druid/t"); while(<FILE>){ if (/steel/){ print FILE2; } } close FILE; close FILE2;

Replies are listed 'Best First'.
(MeowChow) Re3: 2048 character limit
by MeowChow (Vicar) on Jun 06, 2002 at 08:38 UTC
    Try running this:
      
    #!/usr/bin/perl -w use strict; open my $fh_group, "</etc/group" or die "Cannot open group file"; while (<$fh_group>) { chomp; my ($grp, $pwd, $gid, $users) = split /:/; if ($grp eq $ARGV[0]) { my @users = split /,/, $users; print join $/, @users; } }
    Save it to a file, and run it with a command line argument of the group you'd like to check membership for, for example:
    perl program.pl steel
       MeowChow                                   
                   s aamecha.s a..a\u$&owag.print

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://172105]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-04-19 06:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found