批处理pandoc转换 [英] batch processing pandoc conversions

查看:308
本文介绍了批处理pandoc转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

抱歉或太厚.我搜寻了很多内容,以尝试找出如何批处理 pandoc .我无法终生解决.

Sorry or being thick. I've searched high and low to try and work out how to batch process pandoc. I cannot for the life of me work it out.

如何将包含html文件的文件夹和嵌套文件夹转换为markdown?

How do I convert a folder and nested folders containing html files to markdown?

我应该提到我正在使用os x 10.6.8

I should mention that I'm using os x 10.6.8

推荐答案

您可以使用find在目录树中的文件上应用任何命令:

You can apply any command across the files in a directory tree using find:

find . -name \*.md -type f -exec pandoc -o {}.txt {} \;

将在所有后缀为.md的文件上运行pandoc,从而创建后缀为的文件. (如果要获得不带.md.txt后缀,或者要用子shell调用做一些丑陋的事情,则需要一个包装器脚本.){}-exec到终止\;的任何词都将是替换为文件名.

would run pandoc on all files with a .md suffix, creating a file with a .md.txt suffix. (You will need a wrapper script if you want to get a .txt suffix without the .md, or do ugly things with subshell invocations.) {} in any word from -exec to the terminating \; will be replaced by the filename.

这篇关于批处理pandoc转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆