Re: homedir listing and adding domain..
On Thu, 3 Jan 2002 14:03:37 +0200 (EET), <dani@cyber.ro> wrote:
> My problem: i have a homedir for around 800 users.I need to get all of
> them in a text file,each one on each line,with @domain.com after their
> username.. something like
>
> dscfde@domain.com
> 3424.324r2@domain.com
> 4fdr3r@domain.com
> ..
>
> how can i do that,with sed,or..
> thanks
> Dani.
Maybe...
<PERL>
#! /usr/bin/perl -w
local $dir="/home";
local $domain="domain.com";
opendir (DIR, "$dir") or die "Couldn't open '$dir'!\n";
local $entry;
while ($entry = readdir(DIR)) {
next if ($entry =~ m/^\./);
next if ($entry =~ m/^lost[+]found$/);
print "$entry" . "\@" . "$domain\n";
}
</PERL>
$ ./thescript > mylist
--
Eric G. Miller <egm2@jps.net>
Reply to: