codem
codem

Reputation: 31

Regex - Ignore lines with matching text

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

Upvotes: 3

Views: 9528

Answers (1)

Gumbo
Gumbo

Reputation: 655845

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.

Upvotes: 3

Related Questions