tags:

views:

104

answers:

2

I need the RegEx command to get all the lines which DO NOT have the job name containing "filewatch". Any help will be greatly appreciated! Thanks.

STATUS: FAILURE         JOB: i3-imds-dcp-pd-bo1-05-ftpfilewatcher
STATUS: FAILURE         JOB: i3-cur-atmrec-pd-TD_FTP_Forecast_File_Del_M_Su
ALARM: JOBFAILURE       JOB: i3-cur-atmrec-pd-TD_FTP_Forecast_File_Del_M_Su
STATUS: FAILURE         JOB: i3-sss-system-heartbeat
ALARM: JOBFAILURE       JOB: i3-sss-system-heartbeat
STATUS: FAILURE         JOB: i3-chq-cspo-pd-batch-daily-renametable-fileok
STATUS: FAILURE         JOB: i3-chq-cspo-pd-batch-daily-renametable-file
ALARM: JOBFAILURE       JOB: i3-chq-cspo-pd-batch-daily-renametable-fileok
ALARM: JOBFAILURE       JOB: i3-chq-cspo-pd-batch-daily-renametable-file
STATUS: FAILURE         JOB: i3-imds-dcp-pd-bo1-35-filewatcher
STATUS: FAILURE         JOB: i3-imds-dcp-pd-bo1-05-ftpfilewatcher
STATUS: FAILURE         JOB: i3-imds-dcp-pd-bo1-35-filewatcher
STATUS: FAILURE         JOB: i3-imds-dcp-pd-bo1-05-ftpfilewatcher
+3  A: 

If your regular expression implementation supports look-ahead assertions, try this:

^(STATUS|ALARM): +(JOB)?FAILURE +JOB: ((?!filewatch).)+$

Make sure that ^ and $ match the file line begin/end.

Gumbo
Don't you mean that `^` and `$` should match the beginning and end of each *line*?
Tim Pietzcker
@Tim Pietzcker: Ah yes, of course! I meant line but wrote file. ;-)
Gumbo
A: 

Gumbo is correct. Here's a reference to show you how to do these things in the future. http://www.regular-expressions.info/completelines.html

Robusto