> > > "batch mode" doesn't necessarily mean "raw mode". You want to ask for > > > "raw mode", but ask for "batch mode". > > > > Luckily this led me to look up the letter "r" in command line options > > and I happened to find the "-r" option. Which is exactly what I need. > > Fine. > > > My question was so clear. I have to wonder why 3 prior responses did not > > even hint at the solution. > > Simply because I did not know!?
Sorry if I misunderstood, but you seemed to be implying (above) that I should "ask for 'raw mode'", and that is indeed the solution. I don't know how else to ask for it other than by the "-r" option. > Aside from that, I spent the time to created a work-around for you, so > you already have a solution. You said something about "awk" or "sed". Are mySQL users generally familiar with these tools? I'm not, so that was not a solution for me. > > Actually the manual, for "-r", says only: "Write column values without > > escape conversion. Used with --batch." What does this mean exactly? Is > > it only that newlines in output data will not be converted to "\n"? > > >From the output format, I assume that it does the same with tabs > (because tab is used as field seperator). And maybe also for 0-bytes. > And of course with backslashes, because backslashes got a special > meaning now: > > mysql -N -B -e "select 'test\tasdf\01234\\qwert'" > test\tasdf\01234\\qwert > > I had a look at the source and in fact, that are exactly all cases. Seems to me the documentation is confused. It says the effect of using the -r option is to "Write column values without escape conversion." It should explain that what it means by "escape conversion" is that those 4 special characters are converted to 2-character representations (\n, \t, \0, \\ respectively). > > > But doing it this way would render the output completely useless for > > > all uses, except for your special case. > > > > I really have no idea what you mean here. Without -r, mySQL converts > > newlines in output data to the 2 characters slash, n ("\n"). Why would > > output be "completely useless" if it didn't do this?? > > I explained that in my last mail in the part to which you reply here. > Except for the special case, were you know which data belong to which > row, you couldn't tell whether a newline is a newline or the seperator > for a new row. I agree, you couldn't tell. But you haven't explained why that would "render the output completely useless for all uses, except for your special case." IF the user (or system designer) has made a mistake; IF his data contains newlines; IF he does not intend those newlines to be displayed as newlines; IF the fact that they are displayed that way will somehow confuse him; THEN maybe somebody has a problem. It's a question of philosophy: do you design a system with lots of special rules intended to anticipate mistakes and rescue the users who make them? Or do you give users simplicity, power, consistency, and let them get what they ask for? What's more natural, more simple? Output all characters the same way? Or take some of them (4, in this case) and change them to 2-character codes (then forget to document the behavior)? --------------------------------------------------------------------- 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