我正在尝试pdftotext使用 find提取一堆 pdf 的文本:
find /path/to/pdfs -iname "*.pdf" -exec pdftotext {} ~/Desktop/texts/{} \;
但是这不起作用,因为{}包含完整路径(并且路径可以不同)。所以我尝试使用basename,但是似乎没有被find.
find /path/to/pdfs -iname "*.pdf" -exec pdftotext {} ~/Desktop/texts/$(basename {}) \;
我还尝试了反引号和引用整件事的各种方式。似乎没有任何效果。
有没有更优雅的方法来做到这一点?我想用for iLine, line in lines inputFile,所以糖为pairs。但是,这似乎不适用于lines迭代器。我做错了什么,或者这根本不可能?
var iLine = 0
for line in lines inputFile:
for iCell, cell in line:
var val = false
if cell == '#':
val = true
row[iCell] = val
map[iLine] = row
iLine += 1
Run Code Online (Sandbox Code Playgroud)