MySQL - LOAD DATA INFILE - Handling unescaped NULL in INFILE or creating INFILE with escaped NULL
Have you looked into the SELECT INTO OUTFILE syntax?

Here is a quote on the NULL string issue:


  If the FIELDS ESCAPED BY character is empty, no characters are escaped and NULL is output as NULL, not \N. It is probably not a good idea to specify an empty escape character, particularly if field values in your data contain any of the characters in the list just given.


So make sure you indicate a FIELDS ESCAPED BY clause to get NULLs written as \N

Hope this helps