Re: mysqlimport, \r\n and \n
A batch script or shell script can easily be written to do this. -Sheeri On 2/20/06, Daniel Kasak [EMAIL PROTECTED] wrote: I've got some import scripts that are giving me trouble. Some MOFOs keep changing the format of the data they give us, and sometimes I loose half the records. When this happens, I change the line terminator from \r\n to \n ... or from \n to \r\n. It's starting to get to me. Is there any way to ease my pain here, short of importing with one format, counting the number of records, truncating the table, importing wit the other format, counting the number of records, and then selecting the format with the most number of records? -- Daniel Kasak IT Developer NUS Consulting Group Level 5, 77 Pacific Highway North Sydney, NSW, Australia 2060 T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 email: [EMAIL PROTECTED] website: http://www.nusconsulting.com.au -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: mysqlimport, \r\n and \n
On 2/22/06, sheeri kritzer [EMAIL PROTECTED] wrote: A batch script or shell script can easily be written to do this. -Sheeri On 2/20/06, Daniel Kasak [EMAIL PROTECTED] wrote: I've got some import scripts that are giving me trouble. Some MOFOs keep changing the format of the data they give us, and sometimes I loose half the records. When this happens, I change the line terminator from \r\n to \n ... or from \n to \r\n. It's starting to get to me. Is there any way to ease my pain here, short of importing with one format, counting the number of records, truncating the table, importing wit the other format, counting the number of records, and then selecting the format with the most number of records? -- Daniel Kasak IT Developer NUS Consulting Group Level 5, 77 Pacific Highway North Sydney, NSW, Australia 2060 T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 email: [EMAIL PROTECTED] website: http://www.nusconsulting.com.au -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] I would stick with the VBA solution, heh, if you use it you can even call Word and use save as, in fact converting your document to plain ol' windows text file... Then I guess you can go back to Access and just let it roll... -- Daniel da Veiga Computer Operator - RS - Brazil -BEGIN GEEK CODE BLOCK- Version: 3.1 GCM/IT/P/O d-? s:- a? C++$ UBLA++ P+ L++ E--- W+++$ N o+ K- w O M- V- PS PE Y PGP- t+ 5 X+++ R+* tv b+ DI+++ D+ G+ e h+ r+ y++ --END GEEK CODE BLOCK-- -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: mysqlimport, \r\n and \n
Daniel, What about just running your import file through dos2unix before piping it to mysql? That way, it would leave \n alone (since that is unix format) and replace any occurrances of \r\n with plan old \n. -- George -Original Message- From: Daniel Kasak [mailto:[EMAIL PROTECTED] Sent: Monday, February 20, 2006 11:21 PM To: mysql@lists.mysql.com Subject: mysqlimport, \r\n and \n I've got some import scripts that are giving me trouble. Some MOFOs keep changing the format of the data they give us, and sometimes I loose half the records. When this happens, I change the line terminator from \r\n to \n ... or from \n to \r\n. It's starting to get to me. Is there any way to ease my pain here, short of importing with one format, counting the number of records, truncating the table, importing wit the other format, counting the number of records, and then selecting the format with the most number of records? -- Daniel Kasak IT Developer NUS Consulting Group Level 5, 77 Pacific Highway North Sydney, NSW, Australia 2060 T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 email: [EMAIL PROTECTED] website: http://www.nusconsulting.com.au -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: mysqlimport, \r\n and \n
George Law wrote: Daniel, What about just running your import file through dos2unix before piping it to mysql? That way, it would leave \n alone (since that is unix format) and replace any occurrances of \r\n with plan old \n. I could think of a lot of things I could do if this were all running on Linux. Unfortunately the import routine is being triggered from MS Access ... and come to think of it, I'm using 'load data infile' and not 'mysqlimport', but anyway, you get the idea. AFAIK there is no way to trigger anything useful via ODBC. I could write a Perl script, chuck it in my cgi-bin folder, and opening Firefox from Access, passing the script some pointers to the file. But that's dodgy. I suppose while I'm working with Access I'd better get used to dodgy solutions, eh? ;-) -- Daniel Kasak IT Developer NUS Consulting Group Level 5, 77 Pacific Highway North Sydney, NSW, Australia 2060 T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 email: [EMAIL PROTECTED] website: http://www.nusconsulting.com.au -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: mysqlimport, \r\n and \n
A little less dodgy is to write a VBA routine within Access to do the filtering. Alternatively, if you don't want to trust access to do it, you can write a VBScript or JScript routine and run it through the shell (yes, Windoze has shell scripts, too) There are all kinds of things you can do. Shawn Green Database Administrator Unimin Corporation - Spruce Pine Daniel Kasak [EMAIL PROTECTED] wrote on 02/21/2006 04:13:28 PM: George Law wrote: Daniel, What about just running your import file through dos2unix before piping it to mysql? That way, it would leave \n alone (since that is unix format) and replace any occurrances of \r\n with plan old \n. I could think of a lot of things I could do if this were all running on Linux. Unfortunately the import routine is being triggered from MS Access ... and come to think of it, I'm using 'load data infile' and not 'mysqlimport', but anyway, you get the idea. AFAIK there is no way to trigger anything useful via ODBC. I could write a Perl script, chuck it in my cgi-bin folder, and opening Firefox from Access, passing the script some pointers to the file. But that's dodgy. I suppose while I'm working with Access I'd better get used to dodgy solutions, eh? ;-) -- Daniel Kasak IT Developer NUS Consulting Group Level 5, 77 Pacific Highway North Sydney, NSW, Australia 2060 T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 email: [EMAIL PROTECTED] website: http://www.nusconsulting.com.au -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
mysqlimport, \r\n and \n
I've got some import scripts that are giving me trouble. Some MOFOs keep changing the format of the data they give us, and sometimes I loose half the records. When this happens, I change the line terminator from \r\n to \n ... or from \n to \r\n. It's starting to get to me. Is there any way to ease my pain here, short of importing with one format, counting the number of records, truncating the table, importing wit the other format, counting the number of records, and then selecting the format with the most number of records? -- Daniel Kasak IT Developer NUS Consulting Group Level 5, 77 Pacific Highway North Sydney, NSW, Australia 2060 T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 email: [EMAIL PROTECTED] website: http://www.nusconsulting.com.au -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]