develooper Front page | perl.beginners | Postings from February 2012

How to process just part of a file

Thread Next
From:
Clay Lovett
Date:
February 9, 2012 06:08
Subject:
How to process just part of a file
Message ID:
CA2A246D6F00C040A5A7C4A4EFBAA70B171494934A@EXCMAIL.gpi.com
I have inherited a script that processes the cron and comments stuff out for month end processing. We have added some store that do not run the same monthly calendar as the rest of the stores. What I need to know is how to add a start and a finish section to the code so that it only processes the section I want it to. I have included the code below:

while(<CRONDMP>){
        s/\n|\r//g;

        $PoutputFile5pm=
        (/icpw/ && /start_pricingfeed.sh/) ||
        (/icpw/ && /start_inventoryfeed.sh/) ||
        (/icpw/ && /start_customerfeed.sh/) ||
        (/DwInventoryFeed/ && /dw_inventory_feed.pl/) ||
        (/CustFeed/ && /XplCust.sh/) ||
        (/CustFeed/ && /accUpd.sh/) ||
        (/RebateFileExtract/ && /rebate_file_extract.pl/)
        ;

        $PoutputFile915pm=
        (/icpw/ && /start_pricingfeed.sh/) ||
        (/icpw/ && /start_inventoryfeed.sh/) ||
        (/icpw/ && /start_customerfeed.sh/) ||
        (/DwInventoryFeed/ && /dw_inventory_feed.pl/) ||
        (/CustFeed/ && /XplCust.sh/) ||
        (/CustFeed/ && /accUpd.sh/) ||
        (/RebateFileExtract/ && /rebate_file_extract.pl/)
        ;

        if($PoutputFile5pm){
                print CRON5PM "###cmt###$_\n";
        }else{
                print CRON5PM "$_\n";
        }

        if($PoutputFile915pm){
                print CRON915PM "###cmt###$_\n";
        }else{
                print CRON915PM "$_\n";
        }


        print CRONORIG "$_\n";
}

Thanks in advance

Clay Lovett, MBA/TM
UNIX Systems Administrator
GPI Technologies, LLC


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About