techjohnny has asked for the wisdom of the Perl Monks concerning the following question:
My text file contains a line that consists of a group,e.g., 50005, following the group number, there are one more user name, e.g., usera, userb. Each group and user name is separated by a newline.
50000
Craig
Mark
50001
Craig
Steve
50002
Durlene
Floyd
Jeremy
Kent
Leroy
Jessie
Rocky
Sean
Craig
Jeffrey
Rick
#!/usr/bin/perl use warnings; use strict; # comments for myscript_342.pl my $groups; my @line; open my $file, "<", "groupsmembers.txt"; open my $output, ">", "/mnt/backup/output.txt"; while (<$file>) { push @line, $_; } chomp @line; for (@line) { s/^\d+/\n/; s/(\w+)/$1,/; print $output "$_"; }
The above script sorta does what I want, which is to separate the groups and list the user names like: usera, userb, userc each entire group members separated by a newline.
50000 Craig, Mark
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: ADSI groups users
by GrandFather (Saint) on Mar 04, 2011 at 04:26 UTC | |
|
Re: ADSI groups users
by Anonymous Monk on Mar 04, 2011 at 04:59 UTC | |
|
Re: ADSI groups users
by locked_user sundialsvc4 (Abbot) on Mar 04, 2011 at 14:20 UTC | |
by Anonymous Monk on Mar 04, 2011 at 14:54 UTC |