#过滤oracle警告日志文件ORA-错误 $c=Get-Content C:\script.txt | select-string -pattern "ora-" #判断ORA-错误存在条件 #若$c返回值为null,则输出1返回值结束循环 if ( $c -eq $null ) { write-host "STATE_OK" $STATE_OK = {return 1;} $b = &$STATE_OK $b } #若$c返回值不为空,则复制oracle警告日志,清空原警告日志,返回0结束循环 else { copy C:\script.txt C:\scriptbak.txt write-host "STATE_ERROR" write-host "$c" " " > C:\script.txt $STATE_CRITICAL = {return 0;Write-Host "$c" } $a = &$STATE_CRITICAL $a }
本文出自 “O Record” 博客,请务必保留此出处http://evils798.blog.51cto.com/8983296/1420879
powershell_读取ORA错误脚本,布布扣,bubuko.com
原文地址:http://evils798.blog.51cto.com/8983296/1420879