Hi, I need some advice on what to do. I have this MySQL insert file,
with about 30,000 records. One of the datafields has names in it. When
this list was put together, apparently there was extra space formatting
inserted at the end of each name. I want to remove these, so for
example:
INSERT INTO `table_one` VALUES ('John Doe ', 1);
INSERT INTO `table_one` VALUES ('Jane Doe ', 2);
INSERT INTO `table_one` VALUES ('Baby S. Doe ', 3);
I want:
INSERT INTO `table_one` VALUES ('John Doe', 1);
INSERT INTO `table_one` VALUES ('Jane Doe', 2);
INSERT INTO `table_one` VALUES ('Baby S. Doe', 3);
I was thinking some kind of script could be put together to trim the
extra spaces out. I have this entire insert list as a text file and can
re-insert it, or leave it in the DB and run queries against it. What
complicates this for me is some of the name fields have middle names,
some do not. Maybe something to remove all spaces greater than one on a
first pass, and then on a second pass trim the extra space at the end
only. That is what I think of in theory - but have no idea how to
create such script. Can anyone help? I would be very much appreciated.
Sincerely,
Alex