Modify my perl script?

Modify my perl script?

Post by Ron Ablan » Sat, 14 Jun 1997 04:00:00



Could someone please help me modify this perl script file?  What it does  
is it takes an ascii file and sends it as a message to each member in
another text file.  I need this file to just pause one second after it
says

every email address.  Thanks.

 
 
 

Modify my perl script?

Post by Srinivasa Ra » Tue, 17 Jun 1997 04:00:00


I hope the following piece of code gives you an idea.

    open (FILE,"/user/rsr/Public/weeklies/$date");

    $file_name = "|/bin/mail"." ".$query->param('mail_address').", ".$query->param('mail_address_cc');
    open(MAILER,"$file_name");
    print MAILER "From: ", $query->param('name'), "\n";
    print MAILER "To: ", $query->param('mail_address'),"\n";

    .....


> Could someone please help me modify this perl script file?  What it does  
> is it takes an ascii file and sends it as a message to each member in
> another text file.  I need this file to just pause one second after it
> says

> every email address.  Thanks.

--

-srinu-

 
 
 

Modify my perl script?

Post by Craig Fielden-Windso » Tue, 17 Jun 1997 04:00:00


I did this in a shell script a couple of years ago when looking for a
new job - it doesn't have the one second delay, but you also don't need
to hit enter after every email address any way. Hope it suits your
needs, and I'm sure someone will be able to addin the code needed to put
in a time delay of one second between each mailing.

#!/bin/csh
#
# sfile mfile lfile
#
# send file mfile to addresses listed in lfile
#
/bin/cp $1 /tmp/mfile
/bin/cp $2 /tmp/lfile
echo 'Mailing '$1' to '
cat $2
awk '{print "mail " $0 " </tmp/mfile"}' /tmp/lfile >! /tmp/dfile
chmod u+rwx /tmp/dfile
/tmp/dfile
/bin/rm /tmp/dfile /tmp/mfile /tmp/lfile


> I hope the following piece of code gives you an idea.

>     open (FILE,"/user/rsr/Public/weeklies/$date");

>     $file_name = "|/bin/mail"." ".$query->param('mail_address').", ".$query->param('mail_address_cc');
>     open(MAILER,"$file_name");
>     print MAILER "From: ", $query->param('name'), "\n";
>     print MAILER "To: ", $query->param('mail_address'),"\n";

>     .....


> > Could someone please help me modify this perl script file?  What it does
> > is it takes an ascii file and sends it as a message to each member in
> > another text file.  I need this file to just pause one second after it
> > says

> > every email address.  Thanks.

> --

> -srinu-

 
 
 

Modify my perl script?

Post by Aviv Acoc » Mon, 23 Jun 1997 04:00:00


Hi....

Can anyone help me on this one please .... how do I enter a space in
Unix when I'm
using FTP.... for example how do I change directory CD into a directory
named
something like this ===>  My Files

help me out of this one.......

Aviv


 
 
 

Modify my perl script?

Post by Tri Tr » Tue, 24 Jun 1997 04:00:00


        Try putting quotes around the cd command.


> Hi....
> Can anyone help me on this one please .... how do I enter a space in
> Unix when I'm
> using FTP.... for example how do I change directory CD into a directory
> named
> something like this ===>  My Files
> help me out of this one.......
> Aviv


--
-----------------------------------------------------------------
Tri Tram, Computer Science and Engineering at UCLA
http://www.seas.ucla.edu/~tram
 
 
 

Modify my perl script?

Post by su.. » Tue, 24 Jun 1997 04:00:00


:       Try putting quotes around the cd command.
:
Try putting quotes around the path name..


: > Hi....
:
:
: > Can anyone help me on this one please .... how do I enter a space in
: > Unix when I'm
: > using FTP.... for example how do I change directory CD into a directory
: > named
: > something like this ===>  My Files
:
:
: > help me out of this one.......
:
:
: > Aviv
:

:
: --
: -----------------------------------------------------------------
: Tri Tram, Computer Science and Engineering at UCLA
: http://www.seas.ucla.edu/~tram
:

--
.--------------------------------.

|--------------------------------|
| http://www.ce.net/users/super/ |
|    Fight SPAM! www.cauce.org   |

`--------------------------------'

 
 
 

Modify my perl script?

Post by Veksler Micha » Fri, 27 Jun 1997 04:00:00


: Hi....

: Can anyone help me on this one please .... how do I enter a space in
: Unix when I'm
: using FTP.... for example how do I change directory CD into a directory
: named
: something like this ===>  My Files

: help me out of this one.......

: Aviv


What's wrong with

  ftp>  cd "My Files"
  250 CWD command successful.
  ftp>

 
 
 

Modify my perl script?

Post by Harry Anders » Fri, 27 Jun 1997 04:00:00



Quote:

>Hi....

>Can anyone help me on this one please .... how do I enter a space in
>Unix when I'm
>using FTP.... for example how do I change directory CD into a directory
>named
>something like this ===>  My Files

Don't use spaces in the filenames or paths, if you want to space things use
the _ or -.  Otherwise, like you've discovered, you create problems using
shell scripts to interact and manipulate the files.
--
Harry K Anderson, III
Sr Reactor Engineer
Palo Verde Nuclear Generating Station
(Remove filter to respond)
 
 
 

1. please help me modify this perl script

Could someone please help me modify this perl script that I just
inherited?
I got this because I am the new secretary for this club at my
university.
What it does is send an ascii text file as a message to all members of a
distribution list which contains email addresses (one per line).  I
would
like it to do 2 things: 1) allow one to backspace when it prompts me for
data and 2) eliminate those fork errors that I somehow don't get when I
split the distribution list in half and run the script for each.  Just
for your info, we have about 66 members on the list.

#!/sequoia/software/perl/bin/perl
open(SOURCE,"distribution_list") || die "cannot open distribution_list";
$SentCounter = 0;
print "Enter file to distribute:  ";
$distribution_file = <STDIN>;
chop($distribution_file);
print "Enter message subject string:  ";
$subject = <STDIN>;
chop($subject);

print "\n     This could take a while.  Please wait.\n\n";
while ($field = <SOURCE>) {
    chop($field);
    unless (fork) {
        exec("mailx -s '$subject' $field < $distribution_file");
    }
    print "Message sent to: $field\n";
    sleep 5;
    $SentCounter = $SentCounter + 1;
print "\n     All done!\n\n" ;
print "     Mail sent to: $SentCounter users\n\n";
close(SOURCE);

2. Linux Developer Panel

3. Help modify my perl script?

4. LILO - Installed for boot floppy, now I want in on the harddrive...

5. Execute a sh script under perl and sh: sh script; perl script?

6. Partitioning wierdness with 2048-byte sectors

7. modifying the printcap with shell- or perl-scripts

8. A LOT of help needed

9. Apache-perl: place html files and perl scripts in the same location

10. ksh 1, perl 2 - ksh or perl for scripting?

11. A script that modifies other scripts

12. Incomplete output from crontab email: running shell scripts from a perl script

13. Question: Use a Perl Script to Make a Call to a Bourne Shell Script?