First, some disclosure: I am not a Linux admin, and my Linux admin is not a programmer.
That said, we have a cronjob that runs a mysqlimport
command to import a text file that's generated daily. I have no control or involvement in how this file is created. Through trial and error, we discovered that the text file is generated on a Windows machine, so for the lines-terminated-by
argument we had to specify \r\n
. Last week it stopped working correctly, and we determined it was because the file was now being generated in Linux, so we changed it to just \n
. My understanding (which isn't entirely clear) is that it depends on who generates the text file that determines what platform and encoding is used.
We have a shell script that's executing the mysqlimport
command. When we provide the correct encoding, everything works perfectly. But since we don't know who's going to create the text file in the first place, is there a way to determine what the encoding is and implement the proper line-break character(s)? (And is "encoding" the proper term here?)