Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need some help, no idea where to start

Status
Not open for further replies.

subok

MIS
Feb 21, 2005
37
0
0
BE
I need to parse a 2 csv files copied to a directory every X minutes.
Then calculate the ratio of the column "numOctetsReceived" and "numOctetsSent"
Depending on the result ratio, i have to execute a ms-dos batch file (e.g. low.bat or high.bat)

HEADER;UtilizationData;10;V16SG; ;0;SCANNER; ;0;numM3UA-MsgSent;numM3UA-MsgReceived;num-PacketsSent;num-PacketsReceived;numOctetsSent;numOctetsReceived;numM3UA-MsgDiscarded;numOctetsSentNoCtrl;numOctetsReceivedNoCtrl;numOctetsRetransNoCtrl
UtilizationData;V16SG;2012/08/24;07:45:00;mar01.169;900;FALSE;SCANNER;10;406;352;2434;2489;113104;102532;0;21064;10248;0
UtilizationData;V16SG;2012/08/24;07:45:00;mar01.140;900;FALSE;SCANNER;10;691;1233;3575;3507;172288;177784;0;49404;56964;0
UtilizationData;V16SG;2012/08/24;07:45:00;mar01.134;900;FALSE;SCANNER;10;1190;1287;3981;3855;226444;196604;0;91968;66008;0
UtilizationData;V16SG;2012/08/24;07:45:00;mar01.58;900;FALSE;SCANNER;10;24559;14349;34882;23278;4385500;2594184;0;3301252;1822816;0
UtilizationData;V16SG;2012/08/24;07:45:00;mar01.61;900;FALSE;SCANNER;10;13925;14389;27026;19720;3431516;2470008;0;2611156;1817592;0
UtilizationData;V16SG;2012/08/24;07:45:00;mar01.64;900;FALSE;SCANNER;10;14075;13516;26278;18896;3340120;2377748;0;2540128;1750084;0
UtilizationData;V16SG;2012/08/24;07:45:00;mar01.31;900;FALSE;SCANNER;10;12605;11992;23916;17233;3073664;2147408;0;2348784;1576660;0
UtilizationData;V16SG;2012/08/24;07:45:00;mar01.42;900;FALSE;SCANNER;10;11457;11921;22870;16729;2818964;2128756;0;2126204;1574088;0
UtilizationData;V16SG;2012/08/24;07:45:00;mar01.92;900;FALSE;SCANNER;10;12280;12790;24347;17780;3003564;2242712;0;2266696;1653752;0
UtilizationData;V16SG;2012/08/24;07:45:00;mar01.103;900;FALSE;SCANNER;10;11458;13688;24462;18206;2833804;2362424;0;2094388;1760288;0
UtilizationData;V16SG;2012/08/24;07:45:00;mar01.105;900;FALSE;SCANNER;10;12935;12442;24549;17708;3075536;2221472;0;2330916;1633776;0
UtilizationData;V16SG;2012/08/24;07:45:00;mar01.73;900;FALSE;SCANNER;10;1492;978;3879;3525;223568;186292;0;91644;62952;0
UtilizationData;V16SG;2012/08/24;07:45:00;mar01.118;900;FALSE;SCANNER;10;1083;928;3496;3298;187452;174248;0;66412;57872;0
UtilizationData;V16SG;2012/08/24;07:45:00;mar01.126;900;FALSE;SCANNER;10;1000;833;3306;3124;177636;165824;0;61836;54496;0
UtilizationData;V16SG;2012/08/24;07:45:00;mar01.132;900;FALSE;SCANNER;10;948;767;3206;3027;171760;156652;0;58760;48040;0
UtilizationData;V16SG;2012/08/24;07:45:00;mar01.170;900;FALSE;SCANNER;10;60;2;2081;2140;83228;84048;0;1680;1792;0
UtilizationData;V16SG;2012/08/24;07:45:00;mar01.141;900;FALSE;SCANNER;10;745;1281;3602;3504;178804;186624;0;54124;64320;0
UtilizationData;V16SG;2012/08/24;07:45:00;mar01.136;900;FALSE;SCANNER;10;1396;1263;4157;3967;244936;198156;0;105468;64408;0
UtilizationData;V16SG;2012/08/24;07:45:00;mar01.59;900;FALSE;SCANNER;10;13715;12710;25311;18152;3343200;2276832;0;2572812;1674784;0
UtilizationData;V16SG;2012/08/24;07:45:00;mar01.62;900;FALSE;SCANNER;10;14748;13584;26898;19245;3429988;2393260;0;2610396;1755616;0
UtilizationData;V16SG;2012/08/24;07:45:00;mar01.66;900;FALSE;SCANNER;10;13330;12549;24913;17862;3186796;2254724;0;2429952;1660732;0
UtilizationData;V16SG;2012/08/24;07:45:00;mar01.38;900;FALSE;SCANNER;10;12662;13688;25424;18624;3050316;2349708;0;2280316;1732348;0
UtilizationData;V16SG;2012/08/24;07:45:00;mar01.69;900;FALSE;SCANNER;10;10919;12783;23225;17282;2783728;2231648;0;2082100;1660200;0
UtilizationData;V16SG;2012/08/24;07:45:00;mar01.94;900;FALSE;SCANNER;10;13939;13392;26197;18810;3314100;2323428;0;2519032;1698860;0
UtilizationData;V16SG;2012/08/24;07:45:00;mar01.102;900;FALSE;SCANNER;10;11818;12380;23573;17222;2955636;2220868;0;2241736;1650124;0
UtilizationData;V16SG;2012/08/24;07:45:00;mar01.104;900;FALSE;SCANNER;10;13200;13982;26140;19066;3205476;2419040;0;2413604;1786472;0
UtilizationData;V16SG;2012/08/24;07:45:00;mar01.106;900;FALSE;SCANNER;10;13306;13436;25686;18666;3205796;2347652;0;2426060;1729292;0
UtilizationData;V16SG;2012/08/24;07:45:00;mar01.74;900;FALSE;SCANNER;10;1047;793;3317;3122;180856;164896;0;64652;53432;0

Thanks a lot for any help.
 
Hi

Why a new thread ? The only difference I see compared to thread219-1691087 is the changed extensions of the scripts to run.

Next time please write a meaningful subject to your thread. Will be easier to find it later.

Feherke.
[link feherke.github.com/][/url]
 
Hi Feherke,

I thought it would be more practical to open a new thread because the goal is different though the files to be process is the same. I'm also a bit desperate because i'm running out of time to deliver have the scripts running.

my apologies.

subok
 
Hi

subok said:
the goal is different though the files to be process is the same
Sorry, I can not find the difference.

[green][floatl]old thread[/floatl][/green][red][floatr]new thread[/floatr][/red]
[green]
[floatl][bbox]need some help on perl[/bbox][/floatl][/green][red][floatr][bbox]Need some help, no idea where to start[/bbox][/floatr]
[/red]

[green][floatl][bbox]I have files that is copied on a regular basis [gray](...)[/gray] The file is a csv file and come every 5 minutes[/bbox][/floatl][/green]
[red][floatr][bbox]I need to parse a 2 csv files copied to a directory every X minutes.[/bbox][/floatr][/red]

[green][floatl][bbox]i need to check the contents to calculate the ratio. [gray](...)[/gray] depending on the result. ( e.g. .50) it will call another script low.pl ( e.g. .99) it will call another script high.pl[/bbox][/floatl][/green][red][floatr][bbox]Depending on the result ratio, i have to execute a ms-dos batch file (e.g. low.bat or high.bat)[/bbox][/floatr][/red]



[green][floatl][bbox]I need to calculate the ratio of "OctetsSent" and "OctetsReceived"[/bbox][/floatl][/green][red][floatr][bbox]Then calculate the ratio of the column "numOctetsReceived" and "numOctetsSent"[/bbox][/floatr]
[/red]



Feherke.
[link feherke.github.com/][/url]
 
subok - what are you having problems with? Post the code you've written and explain the problems you're having and I'm sure someone will be more than willing to help you solve them.
 
The file is like this (i pasted the wrong one above)

In the HEADER;allAssociationUtilizationData;10;V16SG; ;0;SCANNER; ;0;numM3UA-MsgSent;numM3UA-MsgReceived;numSCTP-PacketsSent;numSCTP-PacketsReceived;numOctetsSentPerAssoc;numOctetsReceivedPerAssoc;numM3UA-MsgDiscarded;numOctetsSentPerAssocNoCtrl;numOctetsReceivedPerAssocNoCtrl;numOctetsRetransPerAssocNoCtrl

Need to retrieve the value of numOctetsSentPerAssoc & numOctetsReceivedPerAssoc and take the ratio.

Need to run the script using Active-Perl for Windows

/**** file.txt *********
HEADER;all30MinSignallingLinkDurationData;5;V15; ;0;SCANNER; ;0;slFailed;slInServiceDuration;slRemoteProcOutage;slUnavailabilityDuration;inhLinkDurUnavail
all30MinSignallingLinkDurationData;V15;2012/08/24;07:45:00;MAR01.4.1.0;900;FALSE;SCANNER;5;0;900;0;0;0
all30MinSignallingLinkDurationData;V15;2012/08/24;07:45:00;MAR01.3.3.0;900;FALSE;SCANNER;5;0;900;0;0;0
all30MinSignallingLinkDurationData;V15;2012/08/24;07:45:00;MAR01.4.2.0;900;FALSE;SCANNER;5;0;900;0;0;0
all30MinSignallingLinkDurationData;V15;2012/08/24;07:45:00;MAR01.3.3.1;900;FALSE;SCANNER;5;0;900;0;0;0
all30MinSignallingLinkDurationData;V15;2012/08/24;07:45:00;MAR01.3.12.2;900;FALSE;SCANNER;5;0;900;0;0;0
all30MinSignallingLinkDurationData;V15;2012/08/24;07:45:00;MAR01.3.3.2;900;FALSE;SCANNER;5;0;900;0;0;0
all30MinSignallingLinkDurationData;V15;2012/08/24;07:45:00;MAR01.3.5.0;900;FALSE;SCANNER;5;0;900;0;0;0
HEADER;allAssociationDurationData;8;V16SG; ;0;SCANNER; ;0;assocUnavailable;assocAvailable;sctpPathUnavailable;sctpAssocCongestion;numCongestionLevel1;numCongestionLevel2;numCongestionLevel3;numPerAssocUnavailable
allAssociationDurationData;V16SG;2012/08/24;07:45:00;MAR01.1;900;FALSE;SCANNER;8;900;0;900;0;0;0;0;0
allAssociationDurationData;V16SG;2012/08/24;07:45:00;MAR01.2;900;FALSE;SCANNER;8;900;0;900;0;0;0;0;0
allAssociationDurationData;V16SG;2012/08/24;07:45:00;MAR01.3;900;FALSE;SCANNER;8;900;0;900;0;0;0;0;0
allAssociationDurationData;V16SG;2012/08/24;07:45:00;MAR01.4;900;FALSE;SCANNER;8;900;0;900;0;0;0;0;0
allAssociationDurationData;V16SG;2012/08/24;07:45:00;MAR01.5;900;FALSE;SCANNER;8;900;0;900;0;0;0;0;0
allAssociationDurationData;V16SG;2012/08/24;07:45:00;MAR01.6;900;FALSE;SCANNER;8;900;0;900;0;0;0;0;0
allAssociationDurationData;V16SG;2012/08/24;07:45:00;MAR01.7;900;FALSE;SCANNER;8;900;0;900;0;0;0;0;0
allAssociationDurationData;V16SG;2012/08/24;07:45:00;MAR01.8;900;FALSE;SCANNER;8;900;0;900;0;0;0;0;0
allAssociationDurationData;V16SG;2012/08/24;07:45:00;MAR01.9;900;FALSE;SCANNER;8;900;0;0;0;0;0;0;0
allAssociationDurationData;V16SG;2012/08/24;07:45:00;MAR01.10;900;FALSE;SCANNER;8;900;0;900;0;0;0;0;0
allAssociationDurationData;V16SG;2012/08/24;07:45:00;MAR01.11;900;FALSE;SCANNER;8;900;0;900;0;0;0;0;0
allAssociationDurationData;V16SG;2012/08/24;07:45:00;MAR01.12;900;FALSE;SCANNER;8;900;0;900;0;0;0;0;0
allAssociationDurationData;V16SG;2012/08/24;07:45:00;MAR01.13;900;FALSE;SCANNER;8;0;900;0;0;0;0;0;0
allAssociationDurationData;V16SG;2012/08/24;07:45:00;MAR01.14;900;FALSE;SCANNER;8;0;900;0;0;0;0;0;0
allAssociationDurationData;V16SG;2012/08/24;07:45:00;MAR01.15;900;FALSE;SCANNER;8;0;900;0;0;0;0;0;0
allAssociationDurationData;V16SG;2012/08/24;07:45:00;MAR01.16;900;FALSE;SCANNER;8;0;900;0;0;0;0;0;0
allAssociationDurationData;V16SG;2012/08/24;07:45:00;MAR01.17;900;FALSE;SCANNER;8;0;900;0;0;0;0;0;0
allAssociationDurationData;V16SG;2012/08/24;07:45:00;MAR01.18;900;FALSE;SCANNER;8;0;900;0;0;0;0;0;0
allAssociationDurationData;V16SG;2012/08/24;07:45:00;MAR01.19;900;FALSE;SCANNER;8;0;900;0;0;0;0;0;0
allAssociationDurationData;V16SG;2012/08/24;07:45:00;MAR01.20;900;FALSE;SCANNER;8;0;900;0;0;0;0;0;0
HEADER;allAssociationUtilizationData;10;V16SG; ;0;SCANNER; ;0;numM3UA-MsgSent;numM3UA-MsgReceived;numSCTP-PacketsSent;numSCTP-PacketsReceived;numOctetsSentPerAssoc;numOctetsReceivedPerAssoc;numM3UA-MsgDiscarded;numOctetsSentPerAssocNoCtrl;numOctetsReceivedPerAssocNoCtrl;numOctetsRetransPerAssocNoCtrl
allAssociationUtilizationData;V16SG;2012/08/24;07:45:00;MAR01.169;900;FALSE;SCANNER;10;406;352;2434;2489;113104;102532;0;21064;10248;0
allAssociationUtilizationData;V16SG;2012/08/24;07:45:00;MAR01.140;900;FALSE;SCANNER;10;691;1233;3575;3507;172288;177784;0;49404;56964;0
allAssociationUtilizationData;V16SG;2012/08/24;07:45:00;MAR01.134;900;FALSE;SCANNER;10;1190;1287;3981;3855;226444;196604;0;91968;66008;0
allAssociationUtilizationData;V16SG;2012/08/24;07:45:00;MAR01.58;900;FALSE;SCANNER;10;24559;14349;34882;23278;4385500;2594184;0;3301252;1822816;0
allAssociationUtilizationData;V16SG;2012/08/24;07:45:00;MAR01.61;900;FALSE;SCANNER;10;13925;14389;27026;19720;3431516;2470008;0;2611156;1817592;0
allAssociationUtilizationData;V16SG;2012/08/24;07:45:00;MAR01.64;900;FALSE;SCANNER;10;14075;13516;26278;18896;3340120;2377748;0;2540128;1750084;0
allAssociationUtilizationData;V16SG;2012/08/24;07:45:00;MAR01.31;900;FALSE;SCANNER;10;12605;11992;23916;17233;3073664;2147408;0;2348784;1576660;0
allAssociationUtilizationData;V16SG;2012/08/24;07:45:00;MAR01.42;900;FALSE;SCANNER;10;11457;11921;22870;16729;2818964;2128756;0;2126204;1574088;0
allAssociationUtilizationData;V16SG;2012/08/24;07:45:00;MAR01.92;900;FALSE;SCANNER;10;12280;12790;24347;17780;3003564;2242712;0;2266696;1653752;0
allAssociationUtilizationData;V16SG;2012/08/24;07:45:00;MAR01.103;900;FALSE;SCANNER;10;11458;13688;24462;18206;2833804;2362424;0;2094388;1760288;0
allAssociationUtilizationData;V16SG;2012/08/24;07:45:00;MAR01.105;900;FALSE;SCANNER;10;12935;12442;24549;17708;3075536;2221472;0;2330916;1633776;0
allAssociationUtilizationData;V16SG;2012/08/24;07:45:00;MAR01.73;900;FALSE;SCANNER;10;1492;978;3879;3525;223568;186292;0;91644;62952;0
allAssociationUtilizationData;V16SG;2012/08/24;07:45:00;MAR01.118;900;FALSE;SCANNER;10;1083;928;3496;3298;187452;174248;0;66412;57872;0
allAssociationUtilizationData;V16SG;2012/08/24;07:45:00;MAR01.126;900;FALSE;SCANNER;10;1000;833;3306;3124;177636;165824;0;61836;54496;0
allAssociationUtilizationData;V16SG;2012/08/24;07:45:00;MAR01.132;900;FALSE;SCANNER;10;948;767;3206;3027;171760;156652;0;58760;48040;0
allAssociationUtilizationData;V16SG;2012/08/24;07:45:00;MAR01.170;900;FALSE;SCANNER;10;60;2;2081;2140;83228;84048;0;1680;1792;0
allAssociationUtilizationData;V16SG;2012/08/24;07:45:00;MAR01.141;900;FALSE;SCANNER;10;745;1281;3602;3504;178804;186624;0;54124;64320;0
allAssociationUtilizationData;V16SG;2012/08/24;07:45:00;MAR01.136;900;FALSE;SCANNER;10;1396;1263;4157;3967;244936;198156;0;105468;64408;0
allAssociationUtilizationData;V16SG;2012/08/24;07:45:00;MAR01.59;900;FALSE;SCANNER;10;13715;12710;25311;18152;3343200;2276832;0;2572812;1674784;0
HEADER;allSignallingLinkUtilisationData;11;V15; ;0;SCANNER; ;0;receivedMSUs;receivedOctetsSIFSIO;retransmittedOctets;signUnitsReceived;transmittedMSUs;transmittedOctetsSIFSIO;discardedMSUs;slLocalInhibited;slRemoteInhibited;slLocalBlocked;slRemoteBlocked
allSignallingLinkUtilisationData;V15;2012/08/24;07:45:00;MAR01.3.12.2;900;FALSE;SCANNER;11;132;4045;0;0;243;5577;0;0;0;0;0
allSignallingLinkUtilisationData;V15;2012/08/24;07:45:00;MAR01.3.3.0;900;FALSE;SCANNER;11;312;27286;0;0;181;19196;0;0;0;0;0
allSignallingLinkUtilisationData;V15;2012/08/24;07:45:00;MAR01.3.12.1;900;FALSE;SCANNER;11;313;3084;0;0;237;5342;0;0;0;0;0
allSignallingLinkUtilisationData;V15;2012/08/24;07:45:00;MAR01.3.3.1;900;FALSE;SCANNER;11;349;33136;0;0;171;18646;0;0;0;0;0
allSignallingLinkUtilisationData;V15;2012/08/24;07:45:00;MAR01.3.5.0;900;FALSE;SCANNER;11;25;285;0;0;25;285;0;0;0;0;0
allSignallingLinkUtilisationData;V15;2012/08/24;07:45:00;MAR01.3.5.1;900;FALSE;SCANNER;11;25;285;0;0;25;285;0;0;0;0;0
allSignallingLinkUtilisationData;V15;2012/08/24;07:45:00;MAR01.3.4.0;900;FALSE;SCANNER;11;25;285;0;0;143;14426;0;0;0;0;0
allSignallingLinkUtilisationData;V15;2012/08/24;07:45:00;MAR01.3.4.1;900;FALSE;SCANNER;11;298;29918;0;0;129;12765;0;0;0;0;0
allSignallingLinkUtilisationData;V15;2012/08/24;07:45:00;MAR01.3.3.2;900;FALSE;SCANNER;11;352;31342;0;0;157;16327;0;0;0;0;0
allSignallingLinkUtilisationData;V15;2012/08/24;07:45:00;MAR01.3.3.3;900;FALSE;SCANNER;11;342;30234;0;0;191;19089;0;0;0;0;0
allSignallingLinkUtilisationData;V15;2012/08/24;07:45:00;MAR01.3.6.0;900;FALSE;SCANNER;11;4745;50293;0;0;1805;69347;0;0;0;0;0
allSignallingLinkUtilisationData;V15;2012/08/24;07:45:00;MAR01.3.6.1;900;FALSE;SCANNER;11;4083;42290;0;0;2160;81876;0;0;0;0;0
allSignallingLinkUtilisationData;V15;2012/08/24;07:45:00;MAR01.3.7.0;900;FALSE;SCANNER;11;4316;49948;0;0;1795;67370;0;0;0;0;0
allSignallingLinkUtilisationData;V15;2012/08/24;07:45:00;MAR01.3.7.1;900;FALSE;SCANNER;11;4023;45374;0;0;1808;66917;0;0;0;0;0
allSignallingLinkUtilisationData;V15;2012/08/24;07:45:00;MAR01.3.8.0;900;FALSE;SCANNER;11;4279;45464;0;0;1981;72945;0;0;0;0;0
allSignallingLinkUtilisationData;V15;2012/08/24;07:45:00;MAR01.3.8.1;900;FALSE;SCANNER;11;3589;38094;0;0;1595;61114;0;0;0;0;0
allSignallingLinkUtilisationData;V15;2012/08/24;07:45:00;MAR01.3.9.0;900;FALSE;SCANNER;11;3722;44184;0;0;1779;67540;0;0;0;0;0
allSignallingLinkUtilisationData;V15;2012/08/24;07:45:00;MAR01.3.9.1;900;FALSE;SCANNER;11;4159;47510;0;0;1754;67874;0;0;0;0;0
allSignallingLinkUtilisationData;V15;2012/08/24;07:45:00;MAR01.3.13.1;900;FALSE;SCANNER;11;15;225;0;2;24;464;0;0;0;0;0
/*** File.txt end ****
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top