我已经下载了几个epub文件,我需要再次将它们转换为epub,以便我的电子书阅读器可以读取它们。在linux bash中使用正则表达式来更改输出文件名
我可以相当容易地如下使用R请勿转换在批:
setwd('~/Downloads/pubmed')
epub.files = list.files('./',full.names = TRUE,pattern = 'epub$')
for (loop in (1:length(epub.files))) {
command = paste('ebook-convert ',
epub.files[loop],
gsub('\\.epub','.mod.epub',epub.files[loop]))
system(command)
}
但我不知道如何使用Linux的bash做到这一点,我不知道:1)如何分配for循环中的变量,以及ii)如何使用正则表达式来替换bash中的字符串。
任何人都可以帮忙吗?谢谢。