procmail
[Top] [All Lists]

procmail/sed script for Travelocity fare updates

2001-03-03 13:00:38

I think I've successfully written a procmail/sed script which will take a Fare
Watcher update (from Travelocity.com) and forward just the important part to a
pager.

Forwarded for the benefit of others who might like it, plus those who might
error-check it ;-)



Note: make sure your version of sed will handle adding a newline with \n.... my
understanding is that
GNU version 3.02.80 is the first version that did that

That is the version of sed I am using

Here is the script

:0c
{
        :0fbw
        * ^From:(_dot_)*memberservices(_at_)travelocity\(_dot_)com
        * ^Subject: Travelocity.com fare watcher update
        | fgrep -A2 -B2 "PRICE:"  |\
                egrep -vi "PRICE:|----" |\
                sed 's/.00 /.00\n/g' |\
                sed '$d' |\
                tr -s '\012' ' ' |\
                tr -s ' ' |\
                sed 's/.*FROM: /From /g; s/ TO: / to /g; s/(...) //g; s/.00 \$/ 
was \$/g'

        :0
        ! email(_at_)pagercompany(_dot_)com
}


Here's an example of the email that I receive

Date: Fri, 2 Mar 2001 06:06:48 -0600 (CST)
From: Fare Watcher <memberservices(_at_)travelocity(_dot_)com>
Subject: Travelocity.com fare watcher update

Friday, March 2, 2001

Dear TIMOTHY,

Travelocity's Fare Watcher, your ultimate tool for keeping on top of
rapidly changing air fares, found fare changes in 1 of the markets
you are watching.  When you review the airfares below, remember that
fares change rapidly!  Low fares sell out quickly, and the sooner you
check, the more likely you are to find available seats.

Have your travel needs changed? Are you looking to go someplace new?
Remember to update your Fare Watcher subscription so that you're
always notified when fares change to your favorite destinations.

To find one of the fares below, point your web browser to your
Personal Fare Watcher Page on Travelocity by clicking on the
following URL link.  You can also copy and paste the URL into your
browser.

http://dps1.travelocity.com:80/fwemindiv.ctl?fw=99102906758166|TRAVELOCITY

=======   FARES     ============================

*  JAX-GLA   FROM: JACKSONVILLE, FL (JAX)
             TO:   GLASGOW, UK (GLA)
   PRICE:    NEW PRICE      WAS      DIFFERENCE
             ---------    -------    ----------
             $575.00      $678.00     -$103.00



All fares are quoted in US dollars. Fares shown are for one adult
round-trip, between your selected cities. Any applicable discounts will
be added after you choose your flights. These fares include
airline-imposed fuel surcharges and some but not all taxes. Fares shown
to the US and Canada do not include a federal segment tax (approximately
$2.75) on each flight segment of your trip. Additional taxes, airport
facility charges and federal segment fees will be shown after your
flights are selected. Fares may not be available on all flights and are
subject to change without notice. Additional taxes/fees may be
associated with international itineraries of up to USD 113. The final fare per
passenger
will be displayed once flights are chosen. Please read the fare rules
for more detail.


========   TRAVELOCITY TIP     ================

Travelocity.com puts you in control of your travel plans right
down to selecting your own seat on a flight. For details on how
seat maps make it easy to see and select your choice of
available seats check out
http://www3.travelocity.com/info/seat_maps/0,,TRAVELOCITY,00.html

========   CUSTOMER SERVICE  ==================

[snipped]

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail