我有一個腳本,它從db2diag.log中提取錯誤消息。我必須從下面的文件中提取導致死鎖的SQL查詢。如何從db2錯誤日誌grep以下sql部分
文件內容:log.txt
db2inst1 , WSCOMUSR , MESSAGE : ADM5501I DB2 is performing lock escalation. The affected application
is named "db2jcc_application", and is associated with the workload
name "SYSDEFAULTUSERWORKLOAD" and application ID
"173.10.105.33.59586.13011817552" at member "0". The total number of
locks currently held is "1249935", and the target number of locks to
hold is "624967". The current statement being executed is "delete
from DMEXPLOG where CREATED < ? ". Reason code "1"
db2inst1 , WSCOMUSR , MESSAGE : ADM5501I DB2 is performing lock escalation. The affected application
is named "db2jcc_application", and is associated with the workload
name "SYSDEFAULTUSERWORKLOAD" and application ID
"173.10.105.33.59586.13011817552" at member "0". The total number of
locks currently held is "1249935", and the target number of locks to
hold is "624967". The current statement being executed is "select
* from DMEXPLOG where CREATED < ?". Reason code "1"
需要的輸出:所有的SQL查詢
1. delete
from DMEXPLOG where CREATED < ?
2. select
* from DMEXPLOG where CREATED < ?
這樣。我想從文件中獲取所有的sql部分。任何grep
或Awk/sed
解決方案獲得所需的輸出?
平臺:UNIX(AIX)
翻譯請看看[編輯的幫助(http://stackoverflow.com/editing-幫幫我)。 – Cyrus