Re: Scripting Help (was Qmail Toaster Help / Perl Help)

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Eric \"Shubes\"
Date:  
To: Main PLUG discussion list
Subject: Re: Scripting Help (was Qmail Toaster Help / Perl Help)
Gilbert T. Gutierrez, Jr. wrote:
> Now I am able to generate a list of all the email addresses on my server.
> The list is in the format...
>
> Email address1
> Password1
> Email address2
> Password2
> ...
>
> I know how to replace the '@' character with a ',' character using tr. What
> I now need to move the password up to the same line as the email address and
> insert a comma between the email address and the password. All email
> addresses end with a ".net, .com, .org, or a .us". I have played with sed
> and tr and have not been able to figure it all out (I have never used sed
> and am not a shell scripting genius by any means).
>
> Does anyone have any pointers on how to do this either using a shell script
> or a perl script?
>
> Any help would be appreciated.
>
> Thank you,
> Gilbert
>

Something like this:

#!/bin/sh
in_file=/path/to/input/file
out_file=/path/to/output/file
out_address=""
out_passwd=""
rm -f $out_file
while read input_field should_be_null; do
  if [ -z "$out_address" ]; then
    out_address=$input_field
  else
    out_passwd=$input_field
    echo "$out_address $out_passwd" >> $out_file
    out_address=""
    out_passwd=""
  fi
done < $in_file
exit 0


--
-Eric 'shubes'
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss