Thanks so much to everyone who chimed in on this one. Most of your
suggestions produced something useful (and I tried 'em all, even after
I had what I needed), and ALL of them are highly educational -- I'll
probably study this thread for days.

Thanks again,
Marv

On 8/3/06, Marv Boyes <[EMAIL PROTECTED]> wrote:
Hello, all. I've been tasked with migrating a large MS Works
"database" into the 21st century. The thing's original setup didn't
enforce any sort of standardization in data entry, so there are nearly
as many different formats and styles in the data as there have been
people entering it. My best bet seems to be to hammer things into
shape with a CSV version of the data before even thinking of trying to
drop it into a new database app. Since it's plain text, Vim seems the
perfect tool for the job. :)

I could use some pointers on search and replace with regular
expressions. I'm sure this will be painfully basic to most of you, but
I can't seem ot get the hang of it for this particular job. Most of
the problem is with dates, in that I have a mishmash of formats. Most
of them are in dashed format, but there's not even much uniformity
_there_: some are MM-DD-YYYY, some are M-D-YY, and so on. What I'd
like to do is reformat them en masse as MM/DD/YYYY; preserving the
original values, replacing dashes with slashes, putting zeroes in
front of existing single digits, and expanding two-digit years into
four digits by bolting on "20" at the front.

For example, let's say I have some dates that look like this:

          7-30-05
          12-5-2006
          10-2-06

What I'd like to end up with is this...

          07/30/2005
          12/05/2006
          10/02/2006

...without, of course, having to re-type every single one by hand. ;)

Since I'm dealing with a finite range of digits before and after each
dash, it seems to my woefully untrained eye that a single global
search and replace with the proper regular expression should do the
trick. I'm just having a heck of a time getting the expression right.
Any and all guidance would be greatly appreciated; thanks very much in
advance.

Reply via email to