[英]bash, how to stdout to file
How do I force the output of the query into a file from a BASH script? 如何从BASH脚本强制查询的输出到文件中?
I have tried 我努力了
> file.txt
| >> file.txt
and a few more 还有一些
I keep blowing out syntax errors or just won't work. 我一直在吹出语法错误,否则将无法正常工作。
find fixed/pdf/ -name '*.pdf' -exec sh -c 'pdftotext "{}" - | grep --with-filename --label="{}" --color "Ascend"' \; | 2>&1 dump.txt
You can use: 您可以使用:
find fixed/pdf/ -name '*.pdf' -exec sh -c 'pdftotext "$1" - |
grep --with-filename --label="$1" --color "Ascend"' - '{}' \; > dump.txt 2>&1
To redirect both stdout and stderr to your file dump.txt
. 要将stdout和stderr都重定向到文件
dump.txt
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.