Specifying patterns to egrep or awk

given this information:

^\w{3} [ :0-9]{11} [._[:alnum:]-]+ kernel:( \[[[:digit:]]+\.[[:digit:]]+\])? [[:alnum:]]+: media error \(bad sector\): status=0x[[:xdigit:]]+ { DriveReady SeekComplete Error }$
^\w{3} [ :0-9]{11} [._[:alnum:]-]+ kernel:( \[[[:digit:]]+\.[[:digit:]]+\])? end_request: I/O error, dev [[:alnum:]]+, sector [[:digit:]]+

i need to set up monitoring for these strings. but as you can see, they contain characters that some applications (i.e. Nagios ) will have issues processing as it considers them potentially risky.

so, will the following changes suffice?

kernel:.*media error.*bad sector.*status=0x.*DriveReady.*SeekComplete.*Error 
kernel:.*end_request: I/O error, dev.*sector 

i basically just got rid of any character i think Nagios may complain about. and i replaced it with ".*". note, each of these strings will be passed to either egrep or awk to scan a log.

can any one of you experts please help point out what may be wrong with what i just did?

Hello SkySmart,

I have made a test file as follows just an example, if there is any change or additional information please let me know.
Input_file:

cat test144
kernel 1234teg media %%4$3@#@gdeyfceb error 1wiyd78t2f52fd)*& bad sector 13693hedh73 status=0x 398r98hfhvr3f DriveReady h3fyg3v SeekComplete @426t3d Error
kernel 243987r2ufh4fh end_request $#:@~! I/O khdwc87e6f7fg error 3513671grftwqhg!@#$vhdc dev e321r2f2fv35 sector

Now following code will look for all strings not the alpha numeric characters in between the words which you need to search as follows.

awk -vs1="kernel media error bad sector status=0x DriveReady SeekComplete Error" 'BEGIN{split(s1, A);s2=length(A)} {for(i=1;i<=NF;i++){S=$i;for(j in A){if(S ~ A[j]){++f;delete A[j]}}};} END{;if(f==s2){print "ERROR LINE FOUND COMPLETLY"}}'  test144

Output will be as follows.

ERROR LINE FOUND COMPLETLY

Similarly you can add more lines for monitoring either they are present or not into the script.

Thanks,
R. Singh

I'm having severe difficulties understanding the request. Is that regexes that you apply and want modified? Or strings that need to be matched? What chars would be considered risky?