所以..我的任务是将一堆 *.doc 文件转换为 *.pdf 使用lowriter
我想做的是就地执行此操作,但由于无法使用 执行此操作lowriter
,我想我会捕获原始文件和路径,捕获转换,然后将转换后的文件移动到原始路径,并且然后删除原来的 *.doc
问题是我的sed
和或awk
充其量是弱的;)所以我无法弄清楚如何从输出中“捕获”转换后的文件名。
我的代码:
#!/bin/bash
FILES=/my/path/**/*.doc
shopt -s globstar
for f in $FILES; do
the_file=$f;
the_orig_dir=$(dirname "$the_file") ;
converted=$(lowriter --headless --convert-to pdf "$the_file");
echo $converted;
done;
输出是:
convert /my/path/Archives/Ally/Heavenly Shop.doc -> /my/Heavenly Shop.pdf using filter : writer_pdf_Export
convert /my/path/Archives/Ally2/Solutions Shop.doc -> /my/Solutions Shop.pdf using filter : writer_pdf_Export
convert /my/path/Archives/Ally3/Xpress Shop.doc -> /my/Xpress Shop.pdf using filter : writer_pdf_Export
我需要做的是->
在:
. 我只是不知道我该怎么做。有人可以告诉我吗?