I have a log file entry that looks like this:
04/21 15:22:56 Information [jrpp-42] - Error Executing Database Query. Stored procedure 'dbo.get_discount' not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output).
The error occurred on line 67. The specific sequence of files included or processed is: /default.cfm || Location -- 10.8.79.7 || Browser -- || Querystring -- sshealth=1 || Referer --I am trying to grep specifically for this part:
Error Executing Database Query. Stored procedure 'dbo.get_discount' not found.
However the part after dbo. is variable. It's not always get_discount. I'm trying to find the regex expression that will account for that and then still include the "' not found" string.
I can do this in two parts but I'm wondering if there is a regular expression that would work. Thanks.
e.g grep "Error Executing Database Query. Stored procedure 'dbo.[REGEX]' not found." filena开发者_运维百科me.log
grep "Stored procedure 'dbo.[^']*' not found" filename.log
You can use grep
or you can use awk
. With awk
you have the advantage to do programming upon finding your string.
awk "/Stored procedure 'dbo.[^']*' not found/" file
精彩评论