Brian! Using mysqlimport with no delimiters worked fine.
Thanks a lot... Ramon -----Original Message----- From: Brian Ivins [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 01, 2002 12:36 PM To: 'Ramon Arias '; '[EMAIL PROTECTED]' Subject: RE: mysqlimpor and fixed length files. If your destination table matches the fixed length record layout exactly, you can import the data using mysqlimport like this: mysqlimport -v --password=yourpasswd yourdb $FULLPATH/yourtablename.yourdatafile --fields-terminated-by= --fields-enclosed-by= I've imported several gigs of data this way. However, the on-line manual now says this isn't supported, so it may be dependant on your MySQL version. I'm running 3.23.49. -----Original Message----- From: Ramon Arias To: Jay Blanchard; [EMAIL PROTECTED] Sent: 5/1/02 9:25 AM Subject: RE: mysqlimpor and fixed length files. Jay, The way that I have been doing it so far is by coverting the source data into tab delimited format with a 'C' utility that I wrote and then loading it using mysqlimport. However I am looking for a way to streamline that process. I am loading about 100 Gigs of data, so that extra step that I am trying to avoid requires a few hours of waiting an about 50 Gigs of extra disk space. Any suggestions? Ramon -----Original Message----- From: Jay Blanchard [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 01, 2002 9:54 AM To: 'Ramon Arias'; [EMAIL PROTECTED] Subject: RE: mysqlimpor and fixed length files. [snip] I need to break it up into fields.... [/snip] Just to make sure that I understand...the data currently looks something like; 100101TestFileData1Data2Data3 and you need the columns to be like; 100101 TestFile Data1 Data2 Data3 If you are on *nix you need to write a script to break up the data with a known file delimeter such as a comma or tab, so the data looks like; 100101","TestFile","Data1","Data2","Data3 or 100101"/t"TestFile"/t"Data1"/t"Data2"/t"Data3 Then you can flag the mysqlimport command with --fields-terminated-by="/t" or "," I have written numerous awk scripts for this kind of problem, we use them every day. Like this ----- #!/bin/sh awk ' { blank = "" RecordID = substr($0, 1, 6) RecordIDSuffix = substr($0, 7, 2) SuffixRecordInd = substr($0, 9, 1) print blank","RecordID","RecordIDSuffix","SuffixRecordInd > "tblNAME.tmp" } }' /usr/local/bin/mysqlimport --host=host --user=user --password=user -f --fiel ds-terminated-by="," databasename tblNAME.tmp rm tblNAME.tmp ----- blank is a place holder for the autoincrement field each other variable is a substring from the overall fixed width record print that info, with comma as delimeter to a tmp file with the same name as the table import that data remove the tmp file Jay Blanchard --------------------------------------------------------------------- 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 --------------------------------------------------------------------- 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