使用Soffice命令行将xls转换为以分号分隔的csv [英] Converting xls to semicolon delimited csv with soffice commandline
问题描述
我正在尝试使用soffice将目录中的xls文件转换为csv格式.
I'm trying to convert xls files in a directory to csv format using soffice.
soffice --headless --convert-to csv *
它给出了逗号分隔的版本(显然).现在,我想获取以分号分隔的csv.
It is giving comma separated version(obviously). Now I want to get semi-colon delimited csv.
我想到了使用vim命令用分号替换逗号.
I thought of replacing commas with semi-colons using vim command.
:%s/,/;/g
但这是不正确的,因为它替换了故意保留在原始内容中的逗号.从xls转换为csv时必须定界.
But it's not correct, as it replaces commas which are kept intentionally in original content. It has to delimit while converting from xls to csv.
如何使用Soffice命令行获取以分号分隔的csv?
How to get semi-colon delimited csv with soffice command line?
推荐答案
最后,我得到了答案.添加output_filter_options很有魅力.
Finally, I got an answer. Adding output_filter_options worked like a charm.
--convert-to output_file_extension[:output_filter_name[:output_filter_options]] [--outdir output_dir] files
此 Wiki链接提供了帮助.这就是我所做的,
This wiki link helped. Here is what I did,
soffice --headless --convert-to csv:"Text - txt - csv (StarCalc)":59,34,0,1,1 *.xls
注意:它适用于libre office 4.3或更高版本.
NOTE: It works with libre office 4.3 or higher version.
这篇关于使用Soffice命令行将xls转换为以分号分隔的csv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!