如何在sqlite中使用CR(回车)而不是LF(换行)进行输出? [英] How to output using CR (Carriage Return) instead of LF (Line Feed) in sqlite?
本文介绍了如何在sqlite中使用CR(回车)而不是LF(换行)进行输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试输出到csv文件中,并使用以下命令:
I am trying to output into a csv file and have used the following commands:
once output.csv;
select * from table;
使用上述命令,它将输出一个使用LF表示换行符的csv文件.无论如何,有没有更改设置,以便在输出文件时使用CR而不是LF?
With the above command, it will output a csv file that uses a LF to represent a line break. Is there anyway to change the settings so it will use a CR instead of a LF when outputting a file?
注意:我可以使用excel打开它,但是如果导出多个文件,这将很麻烦.
Note: I can open it up with excel but this will be a hassle if I am exporting multiple files.
推荐答案
自版本3.8.6起,您可以使用 .separator
命令在CSV模式下定义记录分隔符:
Since version 3.8.6, you can use the .separator
command to also define the record separator in CSV mode:
.mode csv
.separator , "\r"
.once output.csv
select * from mytable;
这篇关于如何在sqlite中使用CR(回车)而不是LF(换行)进行输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文