Scripting Help (was Qmail Toaster Help / Perl Help)
Gilbert T. Gutierrez, Jr.
plug at phxinternet.net
Mon Dec 18 11:29:07 MST 2006
Eric,
Thanks for the help. I am debating which way to go, perl or shell. Here is
the perl script I wrote using "Empty's" line of perl. I am leaning towards
perl so that I can combine my other perl scripts and make everything one
execution.
Gilbert
#!/usr/bin/perl
# This is a script takes a list of email addresses and
# passwords and formats it into a csv file of
# username, domain, password
# Open file with usernames and passwords
open(REGFILE,"registryfile.txt") || die "Cannot open registryfile.txt\n";
# File to store comma separated values
open(NCSV,">encrypt.csv") || die "Cannot open encrypt.csv!\n";
@myreg = <REGFILE>;
foreach $listitem ( @myreg ) {
if (grep(/\.net/, $listitem) || grep(/.com/, $listitem)
|| grep(/.org/, $listitem)) {
$listitem =~ s/\n/,/;
$listitem =~ s/\@/,/;
}
print NCSV $listitem;
}
close (NCSV);
close (REGFILE);
---
[ This E-mail was scanned for viruses by Phoenix Internet ]
[ Phoenix Internet http://www.phoenixinternet.net ]
More information about the PLUG-discuss
mailing list