Hylafax Mailing List Archives
|
[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
Re: [hylafax-users] send large group of unique faxes
> Hi all,
>
> I have been asked to figure out how to send 900 unique text
> based letters to 900 unique recipients. The letters are form
> letters with the address and fax # of the recipient in the body.
>
> All fax numbers in the letters start with 1- so i could parse
> the text for the number and use that to create the sendfax
> command string. Unfortunately my scripting is just not up to
> this and i was hoping someone would be able to point me in
> the right direction.....
>
> Can anyone help me out please?
Well, I know this is a bit off topic, but I actually can help and have
been playing with a regex that maybe others could improve.
I have a spiffy perl file I keep around to test regexes: here it is..
#!/usr/bin/perl
$regexp = shift;
while (<>) {
while (/$regexp/g)
{
print "Matched: [$1]\n";
}
}
I save this as a file named 'grabit' and make it executable. Then I can
type really nasty things like:
grabit '(\+?1?\ *\-?\(?\ *\d{3}\ *\-?\)?\ *\(?\ *\d{3}\ *\-?\)?\(?\
*\d{4})'
And it will take lines on standard input and test them against the
regex. It prints out the first group match in the regex (that stuff
within the parentheses).
That lets me test my regexes to see how they do:
[bill@fastcat bin]$ grabit '(\+?1?\ *\-?\(?\ *\d{3}\ *\-?\)?\ *\(?\
*\d{3}\ *\-?\)?\(?\ *\d{4})'
813-555-1212 1-800-555-1212
Matched: [813-555-1212]
Matched: [1-800-555-1212]
So, in your case, you could use that to write a script much like this
one:
#!/usr/bin/perl
#
# launchfax.pl
# Launces sendfax for each fax number in a list of files. (Sends the
text file that the fax
# number was found in to sendfax).
#
# usage: launchfax.pl { inputfile }+
# input files must have one or more fax number preceded by "Fax:"
#
$regexp = 'Fax:\s*(\+?1?\ *\-?\(?\ *\d{3}\ *\-?\)?\ *\(?\ *\d{3}\
*\-?\)?\(?\ *\d{4})';
while (<>) {
while (/$regexp/g)
{
# remove the "echo" from the following line to make it work
once it's tested
system "echo sendfax -d $1 $ARGV";
}
}
I'd love input from others on how that regex could be improved
(international chars, etc).
Bill
____________________ HylaFAX(tm) Users Mailing List _______________________
To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
On UNIX: mail -s unsubscribe hylafax-users-request@hylafax.org < /dev/null
*To learn about commercial HylaFAX(tm) support, mail sales@hylafax.org.*