473,395 Members | 1,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Please Help for perl Script

HI Guru,
I am newbabe in perl, Could you please help me out.
I am having a file withComma (,) seprater data records. Like below 2 lines
01/09/2008 00:00:00,+99001000000001,http://wap.mysite.com/news/world/ind...00-Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320)

01/09/2008 00:00:02,+99002000000002,http://wap.mysite.com/news/business/....xx,LGE-CX5450 UP.Browser/6.2.2.3.d.1.103 (GUI) MMP/2.0

--------------------------------------
I would like to replace first filed of the line date (01/09/2008) with adding 5 month in existing date and rest of the data should be same.using perl scripts

Input File:
01/09/2008 00:00:00,+99001000000001,http://wap.mysite.com/news/world/ind...00-Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320)

Result file I need:
01/02/2009 00:00:00,+99001000000001,http://wap.mysite.com/news/world/ind...00-Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320)


Note: date in Input file: 01/09/2008 changed to 01/02/2009 means that scripts should add 5 month into exsiting date in file.

Looking for your response asap.

Thanks
Max
Mar 24 '09 #1
2 1719
gpraghuram
1,275 Expert 1GB
To add 5 months to a date you can make use of time functions.
You can first get the tick count for the date in the input.
Add 30 * 5* 86400
then convert the tick back to normal date.

I think there is a date calculator also in unix , which i have used some time back(but i dont remember the command name)

Raghu
Mar 27 '09 #2
numberwhun
3,509 Expert Mod 2GB
@maxman1

To do this, you are going to have to disect each line and pull out the date, then use something like the date::calc module from cpan in order to do the modification.

Why not give this a try and then post your code here if you get stuck.

Regards,

Jeff
Mar 27 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Sandman | last post by:
The subject says it all. I am doing a: I have a perl script in which I am using a ReadParse routine that parses the $ENV{'QUERY_STRING'} or $ENV{'CONTENT_LENGTH'} which are two variables passed...
1
by: sam | last post by:
I have a function writen in Perl that takes a name-value list (array) as argument and returns a name-value list (array). My question is: How to call this function from PHP and get the returned...
3
by: dpackwood | last post by:
Hello, I have two different scripts that do pretty much the same thing. The main perl script is on Windows. It runs and in the middle of it, it then calls out another perl script that then...
1
by: Julia Bell | last post by:
I would like to run the same script on two different platforms. The directory in which the script(s) will be stored is common to the two platforms. (I see the same directory contents regardless...
9
by: Martin Foster | last post by:
Hi. I would like to be able to mimic the unix tool 'uniq' within a Perl script. I have a file with entries that look like this 4 10 21 37 58 83 111 145 184 226...
3
by: PzYon | last post by:
Hey 2gether! I'm trying to execute a PERL script on the web server when the user presses a button in an ASP.NET Web Application using Visual Basic. The most obvious solution for me seemed to be...
21
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
5
by: Louis | last post by:
I am trying to use php to update a spreadsheet (MS Excel or OpenOffice Calc) with data from MySQL. I looked into PEAR::Spreadsheet_Excel_Writer if it will do the job. If I understand it...
12
by: DMcN | last post by:
Firstly this is my first post so thanks in advance for any help. I have created a form in my web page using Flash and all the variables seem OK. So now I have set up the CGI form on my web server...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.