bash:find -exec和filenames

and*_*hky 7 bash exec find w3m

我想从几百个文件中删除HTML.

这是我开始的命令:

find -name *.html -exec w3m {} > w3m {}.html.out \; 
Run Code Online (Sandbox Code Playgroud)

我遇到的问题是它创建了一个单独的大.htm.out文件(名为{..html.out) - 我希望我正在使用的文件被命名为它的原始文件.out.

例如,我有

2002/filename.html
Run Code Online (Sandbox Code Playgroud)

我想通过w3m运行它,并获得2002/filename.html.out

有什么建议?我对其他不使用bash的解决方案持开放态度

我正在使用cygwin.

Ign*_*ams 13

重定向发生在外面find.调用子shell.

find -name *.html -exec bash -c 'w3m "$1" > w3m-"$1".html.out' w3mout {} \; 
Run Code Online (Sandbox Code Playgroud)