On Mon, 14 May 2012 05:41:08 +0000, YAN HONG YE <[email protected]>
wrote:
>when I use :
>
>.output akk.txt
>select * from dhq where qph>0;
>.output stdout
>
> command to write a txt file,I found no "\n\r" in the each line,
Are you sure?
By the way, common lineendings are platform dependent
MS Windows: \r\n = 0x0D 0x0A = cr lf
Unix/Linux: \n = 0x0A = lf
Apple Mac: \r = 0x0D = cr
As far as i know, using
\n\r = 0x0A 0x0D = lf cr
is very very rare. In fact I only saw it on the console interface of a
DATUS portselector, back in the 1980s.
> how to write "\n\r" each line in the output txt file?
Pipe it through awk, for example (Unix/Linux):
printf "select * from dhq where qph>0;\n" \
| sqlite3 your.db \
| awk '{printf "%s\r\n",$0}' \
>akk.txt
In awk on MS Windows, "\n" will render "\r\n", except when BINMODE is
used.
Many programs are able to cope with several different line endings, but
indeed notepad insists on \r\n.
Hope this helps.
--
Regards,
Kees Nuyt
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users