小编qua*_*asi的帖子

find -exec 中的命令替换

我正在尝试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 {}) \;

我还尝试了反引号和引用整件事的各种方式。似乎没有任何效果。

linux bash shell posix find

2
推荐指数
1
解决办法
147
查看次数

在行迭代器上使用对

有没有更优雅的方法来做到这一点?我想用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)

nim-lang

1
推荐指数
1
解决办法
77
查看次数

标签 统计

bash ×1

find ×1

linux ×1

nim-lang ×1

posix ×1

shell ×1