Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Perl question.. i dont know if this is the right place

0 views
Skip to first unread message

sibi...@gmail.com

unread,
Aug 7, 2006, 6:48:02 PM8/7/06
to
I have a file name result01182006.xml which is named according to the
date. I know how to split it to get the values

$a = "result01182006.xml";
$a =~ /^(result)(\d{2})(\d{2})(\d{4})/;
print "$1 $2 $3 $4\n";

In the contents of this file i I need to replace every instance of
1/7/2006 to 01/18/2006.

Change the date of "Sat 07 Jan 2006" to corresponding day which
01/18/2006 falls on, so it should be changed to "Wed 18 Jan 2006

and change the string result01072006 to result01182006

Please can somebody help here.. Working on no sleep whatsover in 24
hrs.

Sibi

use...@davidfilmer.com

unread,
Aug 7, 2006, 7:13:08 PM8/7/06
to
sibi...@gmail.com wrote:
> a multiposted question

http://tinyurl.com/ryucn
http://tinyurl.com/ohy3g
http://tinyurl.com/q234q

Multiposting is universally considered rude in usenet. Folks are
unlikely to help you if you do not abide by basic rules of usenet
courtesy.

--
David Filmer (http://DavidFilmer.com)

Rod Speed

unread,
Aug 8, 2006, 12:03:41 AM8/8/06
to
use...@DavidFilmer.com wrote:
> sibi...@gmail.com wrote:
>> a multiposted question

> Multiposting is universally considered rude in usenet.

Wrong.

There is never ever anything universal about usenet.

> Folks are unlikely to help you if you do not
> abide by basic rules of usenet courtesy.

How odd that so many multiposts get replys.


why?

unread,
Aug 8, 2006, 12:35:52 PM8/8/06
to

On 7 Aug 2006 15:48:02 -0700, sibi...@gmail.com wrote:

There are Perl newsgroups, FAQs, loads of website and mailing lists.

Lots of Perl examples from the above sources deal with regex and dates.

>I have a file name result01182006.xml which is named according to the
>date. I know how to split it to get the values
>
>$a = "result01182006.xml";
>$a =~ /^(result)(\d{2})(\d{2})(\d{4})/;
>print "$1 $2 $3 $4\n";

It's assumed this is an example and you have to change any occurance of
date A to date B and not only 1/7/2006 to 01/18/2006?

Because if it'a single date A to B everywhere and there is no A to C , D
to E swaps then you don't have to do anything beyond a simple replace.
Same goes for Sat 07 Jan 2006 to Wed 19 Jan 2006 it's a simple string
replace and you don't need to look up the Sat to Wed conversion.

>In the contents of this file i I need to replace every instance of
>1/7/2006 to 01/18/2006.
>
>Change the date of "Sat 07 Jan 2006" to corresponding day which
>01/18/2006 falls on, so it should be changed to "Wed 18 Jan 2006
>
>and change the string result01072006 to result01182006
>
>Please can somebody help here.. Working on no sleep whatsover in 24
>hrs.

So is what is your problem -

Modifying files?

The algorithm to lookup / replace text?

A calendar module you can lookup the translation for Sat to Wed?

>Sibi

Me

0 new messages