Link to home
Start Free TrialLog in
Avatar of TPoly
TPoly

asked on

perl code

hi..
i have this statment in the perl script that allows me to extract the date "02/31/04"
and insert it to the database in the form of "2004/02/31"
this is the statment :
  if( /Start Date\s*:\s*(\S+)/ ) {
    $job = $1;
    ($date = $2) =~ s!(\d\d)/(\d\d)/(\d\d)!20$3/$1/$2!;

however, the date formate given  is in this form "thur jul 22 10:10:18 2004"
how do i modify the above statment to extract onlt "jul 22 2004"

thanks.
Avatar of ozo
ozo
Flag of United States of America image

s/\w+\s+(\w+)\s+(\d+)\s+\d\d:\d\d:\d\d\s+(\d\d\d\d)/$1 $2 $3/;
Avatar of TPoly
TPoly

ASKER

hi ozo,
 i tried the statement you have provided but it only extract "thur" and
insert it into the database.
Avatar of TPoly

ASKER

sorry..
my mistake i want to modify the above perl statement from
"thur jul 22 10:10:18 2004" to "2004/07/22"
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of TPoly

ASKER

hi ozo. the state ment work,
however it is unable to insert the date into the database and
also i have have duplicate dates but i have many text files
with different date.