#!/your/path/to/perl

open(OLD, "yourbigfile.txt");
open(FIXED, ">newfile");
while ($line = <OLD>)
{
  $line =~ s/(\d{2})-(\d{2})-(\d{4})/$3-$1-$2/g;
  print FIXED $line;
}

Michael

On Tue, 8 Jan 2002, Jeremy Johnstone wrote:

> 
> I have a flat text file that is about 820mb I need to import into a database
> that has the dates in the format MM-DD-YYYY. MySQL requires dates with the
> year first and when I try importing test chunks of the data all I get is
> zero's in the date field because of the dates being in the wrong format.
> There are about 30 million records so editing the file is not feasible. Will
> someone help me with a solution either with a perl script or some other
> method that you might know of. I am willing to research this further if
> someone will point me in the right direction.
> 
> Thank You
> Jeremy Johnstone
> AltDNS.net inc.
> 
> *** PLEASE REPLY TO MY EMAIL ADDRESS DIRECTLY ***
> ***************     [EMAIL PROTECTED]       ************************
> 

Michael Stassen
University Information Technology Services
Indiana University Bloomington
[EMAIL PROTECTED]


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to