Re: script to compare dates

2009-08-18 Thread Mihir Kamdar
not installed in my Linux box.. while trying to install both DateTime and DateManip in my machine, it is giving some network error..."Url not found..." need to figure out a way to install them.. On Tue, Aug 18, 2009 at 11:22 PM, Steve Bertrand wrote: > Mihir Kamdar wrote: > >

Re: script to compare dates

2009-08-18 Thread Mihir Kamdar
thanks all.and how will be the code like for my requirement if i use DateTime... On Tue, Aug 18, 2009 at 10:09 AM, Shawn H. Corey wrote: > Steve Bertrand wrote: > >> Mihir Kamdar wrote: >> >>> I dont have Datetime module installed. Is there a way without using

Re: script to compare dates

2009-08-18 Thread Mihir Kamdar
I dont have Datetime module installed. Is there a way without using DateTime?? On Tue, Aug 18, 2009 at 7:37 AM, Steve Bertrand wrote: > Mihir Kamdar wrote: > > Hi, > > > > I want to write a script whose input data would be a csv file and records > > would be as follo

script to compare dates

2009-08-18 Thread Mihir Kamdar
Hi, I want to write a script whose input data would be a csv file and records would be as follows:- 60020003076570*,2,*20-SEP-08.01:09:18,,*04-NOV-08* ,1,INR,,VOUCHER_BATCH_20080919_00014,2C,,0 326495*,5,*20-SEP-08.01:09:57,,*31-DEC-09* ,10,INR,,VOUCHER_BATCH_20080919_00024,1K,,0

Re: grep Net::FTP

2009-05-27 Thread Mihir Kamdar
thanks John...my problem is solvedam trying to add more functionalities to the script. Will seek help again if faced with any issue.. On Tue, May 26, 2009 at 11:31 AM, John W. Krahn wrote: > Mihir Kamdar wrote: > >> Hi, >> >> I want to write a perl script which will

grep Net::FTP

2009-05-26 Thread Mihir Kamdar
Hi, I want to write a perl script which will get files from multiple directories in remote location using FTP. Following is the script that I tried:- #!/usr/bin/perl use Net::FTP; use strict; for (my $count=0; $count < 2; $count++) { print "Please enter the directory name to ftp files: \n" ; my $

Re: Longest prefix match

2007-08-27 Thread Mihir Kamdar
Hi Chas, It works...but the problem I have is that some of the records are totally lost. And also the output file keeps on writing multiple times and grows into a huge size. almost 10 times, it keeps on growing until I kill the script. I checked few of the records which have calculated properly a

Re: Longest prefix match

2007-08-27 Thread Mihir Kamdar
On 8/27/07, Chas Owens <[EMAIL PROTECTED]> wrote: > > On 8/27/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote: > snip > > for my $len (reverse $shortest .. > $longest) { > >

Re: Longest prefix match

2007-08-27 Thread Mihir Kamdar
Hi Chas, Look at the following code. It does not change the $cdr[13] value after processing as is desired. #!/usr/bin/perl use strict; use warnings; my $file_path = '/home/user71/RangerDatasource/Customization/TelekomMalaysia/Scripts/Tests/cprogs/files/ratetest'; my $write_path = '/home/user71/

Re: Longest prefix match

2007-08-27 Thread Mihir Kamdar
> > Not a one. Can you provide some test data? > Sure Chas... Following is some sample records:- 2006/09/01 00:19:30,999,+60132868382,+126312437,,1,253,2006/09/01 00:15:17,350370010515510,515111061171520,00043,3,1,0.0 ,7,1,1,1,,0,8,+60132868382,Normal,,TELMT,Alcatel,,, 2006/09/01 00:21:13,999,+6

Re: Longest prefix match

2007-08-27 Thread Mihir Kamdar
On 8/27/07, Chas Owens <[EMAIL PROTECTED]> wrote: > > On 8/27/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote: > snip > > > > my %prefix_to_rate = ( > > > > 12 => 0.30, > > > > 1234 => 0.35, > > > >

Re: Longest prefix match

2007-08-27 Thread Mihir Kamdar
On 8/27/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote: > > > > I can't recommend reinventing the wheel, I would use the module to > > lookup the country name and the use hash where the country name is the > > key and the rate is the value to get the value, but if yo

Re: Longest prefix match

2007-08-27 Thread Mihir Kamdar
I can't recommend reinventing the wheel, I would use the module to > lookup the country name and the use hash where the country name is the > key and the rate is the value to get the value, but if you are dead > set on not using the module your best bet is something like this: > > #!/usr/bin/perl >

Re: Longest prefix match

2007-08-27 Thread Mihir Kamdar
On 8/27/07, Martin Barth <[EMAIL PROTECTED]> wrote: > > Hi, > > do you understand my pseudo code, i think it should work for your hash? > > Regards > Martin Hi Martin, Yes, I guess I understood yr code...if I am correct, i just need to know the longest country code digits and store them in $pref

Re: Longest prefix match

2007-08-27 Thread Mihir Kamdar
On 8/27/07, Jeff Pang <[EMAIL PROTECTED]> wrote: > > 2007/8/27, Mihir Kamdar <[EMAIL PROTECTED]>: > > The sample code below on executing gives result as:- > > Macau > > Hong Kong > > > > But there are 0 keys in the hash. I expected the result to be

Re: Longest prefix match

2007-08-27 Thread Mihir Kamdar
The sample code below on executing gives result as:- Macau Hong Kong But there are 0 keys in the hash. I expected the result to be Hong Kong Macau Why is the hash getting empty here? #!/usr/bin/perl my %countries = ('+852' => 'Hong Kong', '+853' => 'Macau' ); my @string = {'+8521235567','+853

Longest prefix match

2007-08-26 Thread Mihir Kamdar
Hi, I want to implement longest prefix match in my code in perl, but am not able to get started with it. I am sure, it can be easily achieved with the help of regex in perl, but I haven't worked on it. Following is what I want to do:- If the phone number is +852 ---> The country is Hong Kong

Re: manipulating csv file fields through perl

2007-08-24 Thread Mihir Kamdar
Perl isn't a strong type language,it doesn't mind which data type it used. > You can use printf() for printing a floating vlaue,like, > $ perl -e 'printf("%.2f",3)' > 3.00 that's right, but with respect to this particular code of mine, the $cdr[13] is the "amount" field which should be a float.

Re: manipulating csv file fields through perl

2007-08-24 Thread Mihir Kamdar
Hi, Thanks...i got my mistake...it worked after the below as Rob suggested:- my @cdr=split (/,/, $line) ; $cdr[13] = $cdr[6]*5.0 ; $line = join(",",@cdr); $hash{"@cdr[2,3,6,7]"}=$line; But a few im

Re: manipulating csv file fields through perl

2007-08-24 Thread Mihir Kamdar
On 8/24/07, Jeff Pang <[EMAIL PROTECTED]> wrote: > > 2007/8/24, Mihir Kamdar <[EMAIL PROTECTED]>: > > > $cdr[13] = $cdr[6]*5 ; ###Can I do something like this > > sure,why can't? Hi, Please look at my code below and comment. I am trying to manipulate

manipulating csv file fields through perl

2007-08-23 Thread Mihir Kamdar
Hi, I have a csv file. I wanted to do some calculations on some of its fields, like multiplying the 7th field with the 13th field and overwriting the 13th field with the answer of my calculation. Regarding this, can I do the calculations on the input file and overwrite it after calculating, or I

Re: using wc -l in perl

2007-08-07 Thread Mihir Kamdar
On 8/8/07, Chas Owens <[EMAIL PROTECTED]> wrote: > > On 8/7/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote: > > yes Chasit says:- > > there are 0 keys in hash > snip > > > > i think something is going terribly wrong with my code...can u quickly > point

Re: using wc -l in perl

2007-08-07 Thread Mihir Kamdar
e" ; close $OUT_FILE; close $LOG_FILE ; i think something is going terribly wrong with my code...can u quickly point out and advice? On 8/7/07, Chas Owens <[EMAIL PROTECTED]> wrote: > > On 8/7/07, Mihir Kamdar <[EMAIL PROTECTED]>

Re: using wc -l in perl

2007-08-07 Thread Mihir Kamdar
On 8/7/07, Chas Owens <[EMAIL PROTECTED]> wrote: > > On 8/7/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote: > snip > > open (my $OUT_FILE,"+>","$write_path/$file.out") or die > $!; > &g

Re: using wc -l in perl

2007-08-07 Thread Mihir Kamdar
On 8/7/07, Chas Owens <[EMAIL PROTECTED]> wrote: > > On 8/7/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote: > > Hi, > > > > I am trying to count the number of lines in my output file processed by > a > > perl code. > > > > I am not ge

using wc -l in perl

2007-08-07 Thread Mihir Kamdar
Hi, I am trying to count the number of lines in my output file processed by a perl code. I am not getting the syntax correct. I am doing something like below:- my $count1 = `wc -l < $OUT_FILE` ; print $LOG_FILE "Count of cdrs after removing duplicates = $count1" ; I am getting the following er

Re: Problem with my code

2007-08-02 Thread Mihir Kamdar
On 8/2/07, Chas Owens <[EMAIL PROTECTED]> wrote: > > On 8/2/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote: > > > #!/usr/bin/perl > > > > my $child_path = > > > '/home/user71/RangerDatasource/Customization/TelekomMalaysia/Scripts/Tests/cprogs/

Re: Problem with my code

2007-08-02 Thread Mihir Kamdar
On 8/2/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > On Aug 2, 10:48 am, [EMAIL PROTECTED] (Mihir Kamdar) wrote: > > > my $line; > > my %hash; > > my @file; > > my $key ; > > my $value ; > > my %times ; > > You appear to be sufferin

Re: Problem with my code

2007-08-02 Thread Mihir Kamdar
On 8/2/07, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote: > > Ken Foskey wrote: > > I find this style more 'normal'. > > > > foreach my $key (keys %hash) { > > print $OUT_FILE $hash{$key}; > > } > > > > Or even this to make code predictable: >

Re: Problem with my code

2007-08-02 Thread Mihir Kamdar
On 8/2/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote: > > > > On 8/2/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > I have a requirement. There are files in the parent directory and they > > are touched in the child directory. S

Re: Problem with my code

2007-08-02 Thread Mihir Kamdar
On 8/2/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote: > > Hi, > > I have a requirement. There are files in the parent directory and they are > touched in the child directory. So in child directory there are 0 byte files > having the same name as the ones in the parent d

Problem with my code

2007-08-02 Thread Mihir Kamdar
Hi, I have a requirement. There are files in the parent directory and they are touched in the child directory. So in child directory there are 0 byte files having the same name as the ones in the parent directory. I need to read files in the child directory, and for each file present in the child

Opening a directory for writing

2007-08-01 Thread Mihir Kamdar
Hi, I am reading all the files in a directory through readdirNow after reading each of the file and processing it, I want to write their output one by one to a different directory. Please suggest on how can this be done? Thanks, Mihir

Re: Passing each of the files in a directory as parameter to the perl script

2007-08-01 Thread Mihir Kamdar
On 8/2/07, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote: > > Mihir Kamdar wrote: > > It has to be ASAP Shawn..but if that's not possible, as a workaround > > we may also look at every half hour or something like that... > > > > do you have any suggest

Re: Passing each of the files in a directory as parameter to the perl script

2007-08-01 Thread Mihir Kamdar
, Mihir Kamdar <[EMAIL PROTECTED]> wrote: > > hey Rob, > > Can you explain with reference to your code, what does this do: > > my $access = (stat $fname)[8]; > > > On 8/1/07, Paul Lalli < [EMAIL PROTECTED]> wrote: > > > > On Aug 1, 11:14 am, [EMAIL

Re: Passing each of the files in a directory as parameter to the perl script

2007-08-01 Thread Mihir Kamdar
hey Rob, Can you explain with reference to your code, what does this do: my $access = (stat $fname)[8]; On 8/1/07, Paul Lalli <[EMAIL PROTECTED]> wrote: > > On Aug 1, 11:14 am, [EMAIL PROTECTED] (Mihir Kamdar) wrote: > > It has to be ASAP Shawn..but if that's not po

Re: Passing each of the files in a directory as parameter to the perl script

2007-08-01 Thread Mihir Kamdar
yep Rob...u re right... the code that u've posted should do good...am yet to test it Thanks, Mihir On 8/1/07, Rob Dixon <[EMAIL PROTECTED]> wrote: > > Mihir Kamdar wrote: > > > > On 8/1/07, Rob Dixon <[EMAIL PROTECTED]> wrote: > >> > >> Mi

Re: Passing each of the files in a directory as parameter to the perl script

2007-08-01 Thread Mihir Kamdar
will scan through the child directory and process only those files which are present there... And yeah...as u said..i will use sleep after each processing.. Thanks, Mihir On 8/1/07, Tom Phoenix <[EMAIL PROTECTED]> wrote: > > On 8/1/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote:

Re: Passing each of the files in a directory as parameter to the perl script

2007-08-01 Thread Mihir Kamdar
27;ls -lrt *.*" Thanks, Mihir On 8/1/07, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote: > > Mihir Kamdar wrote: > > Also, these input files will keep on coming from some source. So, my > perl > > file has to run continuously and pick each of the files as they come.

Re: Passing each of the files in a directory as parameter to the perl script

2007-08-01 Thread Mihir Kamdar
files as they come. Suggestions to do this will be highly appreciated. Thanks, Mihir On 8/1/07, Rob Dixon <[EMAIL PROTECTED]> wrote: > > Mihir Kamdar wrote: > > > > I have a requirement to read each of the files from a directory and pass > > each one of them as a p

Passing each of the files in a directory as parameter to the perl script

2007-08-01 Thread Mihir Kamdar
Hi, I have a requirement to read each of the files from a directory and pass each one of them as a parameter to my perl script one by one. The requirement is such that my perl script should keep running in the background and it should take each of the files as they enter into the target directory,

Re: Removing duplicate records

2007-08-01 Thread Mihir Kamdar
Thanks Shawn,Yaron,Rob Thanks a lot for your prompt response... The solution is desirable... On 8/1/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hi, > > The code was tested. and it compiles for mee > > > Yaron > > > > - Original Message - > From: "Rob Dixon" <[EMAIL PROT

Re: Removing duplicate records

2007-08-01 Thread Mihir Kamdar
Hi, The result is ok, but one big problem. My input file is a csv file. Its records are like: 2007/02/26 09:38:03,999,+60320840888,+60123773138,,1,5,2007/02/26 09:37:582,1,0,7,1,3,1,,0,4,+60320840888,,BRT70607,NOKIA_160_ISDN,,KL,KL 2007/02/26 09:38:05,999,+6032084,+60326931722,,1,21,2007/0

Removing duplicate records

2007-08-01 Thread Mihir Kamdar
Hi, Need your help with the following:- I have a csv file having many records. I want to remove duplicate records. But the record might not be entirely duplicate. I only have to check if the 2nd, 3rd, 7th and 8th field of a record is same as the earlier records. If it is same, then remove the pr

Re: Help parsing a CSV file

2007-06-25 Thread Mihir Kamdar
fore '/' is greater than the one which is after that. Any improvizations?? Thanks, Mihir On 6/24/07, Tom Phoenix <[EMAIL PROTECTED]> wrote: On 6/24/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote: > I have a csv file having 3rd field as phone number series. In that field,

Help parsing a CSV file

2007-06-24 Thread Mihir Kamdar
Hi, I have a csv file having 3rd field as phone number series. In that field, some of the records are phone number ranges like 097611/4 Now I need to seperate this into 4 numbers and store them one after the other, like:- 097611 097612 097613 097614 There are more than 1000 records in the csv

Re: how to print "\n" in the output file

2006-11-05 Thread Mihir Kamdar
thanks all, the different ways suggested by you gave me a lot of learning. regards, Mihir On 11/5/06, Robin Norwood <[EMAIL PROTECTED]> wrote: "Mihir Kamdar" <[EMAIL PROTECTED]> writes: > 1. (*) text/plain > > hi, > > I am a beginner in Perl. I am tr

Re: how to print "\n" in the output file

2006-11-04 Thread Mihir Kamdar
TTP::Request and HTTP::Response here. How can I calculate the response time on the basis of above data. As always, your help appreciated, Mihir On 11/4/06, Ron Smith <[EMAIL PROTECTED]> wrote: --- Mazhar <[EMAIL PROTECTED]> wrote: > On 11/4/06, Mihir Kamdar <[EMAIL PROTECTED]&g

how to print "\n" in the output file

2006-11-04 Thread Mihir Kamdar
hi, I am a beginner in Perl. I am trying to automatically generate a perl test case file which, on executing, would return HTTP response code and response time,etc. In the output file that I am getting I want the following line: print "\n" ; Any Suggestions?? thanks, Mihir

how to read and process data coming on console

2006-10-27 Thread Mihir Kamdar
hi, I am capturing http transactions by using Net::PcapUtils module. I want to do real time processing on the captured packets. Following is a snippet of data that I am getting: POST /vodexUi/CVodSchedularViewMgr .php HTTP/1.0^M Host: 192.168.1.157^M User-Agent: Mozilla/5.0 (X11; U; Linux i686;

how to read and process data coming on console

2006-10-27 Thread Mihir Kamdar
hi, I am capturing http transactions by using Net::PcapUtils module. I want to do real time processing on the captured packets. Following is a snippet of data that I am getting: POST /vodexUi/CVodSchedularViewMgr.php HTTP/1.0^M Host: 192.168.1.157^M User-Agent: Mozilla/5.0 (X11; U; Linux i686; e

Problems capturing HTTP data.

2006-10-10 Thread Mihir Kamdar
hii, I want to capture all the http packets having all the response information like message type(GET/POST),etc. Also if the method is POST then postbody also I want to capture. I am using Net::Pcap for achieving this. The filter string that I am using is "port 80". But the output I am getting is

Problems with Net::Pcap

2006-10-09 Thread Mihir Kamdar
hii, I want to capture all the http packets having all the response information like message type(GET/POST),etc. Also if the method is POST then postbody also I want to capture. I am using Net::Pcap for achieving this. The filter string that I am using is "port 80". But the output I am getting is

Problems with Net::Pcap

2006-10-09 Thread Mihir Kamdar
hii, I want to capture all the http packets having all the response information like message type(GET/POST),etc. Also if the method is POST then postbody also I want to capture. I am using Net::Pcap for achieving this. The filter string that I am using is "port 80". But the output I am getting is

Re: CSV file that can be loaded to Microsoft Outlook

2006-06-25 Thread Mihir Kamdar
hii, thanx a lot for your immediate reply... now i m able to import but after that it is not taking up correct values. Following is the line that i m trying to import. Now if i keep this as a single line in the CSV file (no word wrap), then Outlook is not importing it. Only if I break the line,

CSV file that can be loaded to Microsoft Outlook

2006-06-24 Thread Mihir Kamdar
hi, I have written a perl script whose output is a CSV file(semicolon seperated) in keeping reference to the Outlook Address Book. But whenever I am importing the file to Outlook, it gives me some data error, and does not get imported. Can anybody help me on this?? thanx, mihir

ldif to CSV

2006-06-08 Thread Mihir Kamdar
hi, I am totally a beginner at perl. I have to write a perl script as following: I am given a ldif(ldap interchange format) file which contains all the information about all employees of my organization. I can use ldapsearch to extract information about one particular employee. I am also given a