问题
I'm trying to convert xls files in a directory to csv format using soffice.
soffice --headless --convert-to csv *
It is giving comma separated version(obviously). Now I want to get semi-colon delimited csv.
I thought of replacing commas with semi-colons using vim command.
:%s/,/;/g
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.
How to get semi-colon delimited csv with soffice command line?
回答1:
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
This wiki link helped. Here is what I did,
soffice --headless --convert-to csv:"Text - txt - csv (StarCalc)":59,34,0,1,1 *.xls
NOTE: It works with libre office 4.3 or higher version.
来源:https://stackoverflow.com/questions/37825864/converting-xls-to-semicolon-delimited-csv-with-soffice-commandline