在 DOS FOR 循环中执行 FIND
我想对目录中所有扩展名为 *.LOG 的文件执行 FIND 命令。我怎样才能实现它?以下是我到目前为止所拥有的,但它不起作用,我不知道问题出在哪里。
for /R C:\folder\log %%i IN (*.LOG) DO (
TYPE %%i | find /I /N "ORA-" >> C:\folder\log\Errorfound.log
ECHO %%i
exit
)
I want to perform a FIND command for all the file extension *.LOG in a directory. How can I achieve it? The below is what I have so far, but it is not working and I do not know where's the problem.
for /R C:\folder\log %%i IN (*.LOG) DO (
TYPE %%i | find /I /N "ORA-" >> C:\folder\log\Errorfound.log
ECHO %%i
exit
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能想要使用
您也可以使用
然后使用该文件作为循环的输入
一些备注
您的输出文件也是您正在搜索的同一文件夹中的.log。如果您多次运行该程序,输出文件将显示在您的结果中,并使输出行数加倍
如果您只能使用标准输入,请不要使用“type [file] | do_it”:“< [file] do_it”
You probably want to use
You could also use
And then use that file as input for your loop
Some remarks
your output file is also a .log in the same folder that you're searching in. If you run the program multiple times, the output file will show up in your results and double your # of output lines
don't use "type [file] | do_it" if you can just use stdin: "< [file] do_it"
有几个人已经给了你答案。要查找所有 Oracle 错误并将其过滤到一个日志中,请运行以下命令:
该命令还包括您所要求的每一行中的文件名。
如果您只想回显文件名,请单独运行第二个命令:
那么,正如您雄辩地说的那样,其中哪一部分“不起作用”?
Several people have already given you the answer. To find and filter all Oracle errors into one log, run this command:
which also includes the filenames in every line as you asked.
If you only want to echo the filenames, run this second command separately:
So which part of these is "not working" as you so eloquently put it?