Regex - Ignore lines with matching text
I need a RegEx command to get all lines that do not have a job name containing "filewatch". Any help would be 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
+2
source to share
2 answers
If the regex implementation supports predictive assertions , try this:
^(STATUS|ALARM): +(JOB)?FAILURE +JOB: ((?!filewatch).)+$
Make sure ^
and $
match the start / end of the line file...
+3
source to share
Gumbo is correct. Here's a link to show you how to do it in the future. http://www.regular-expressions.info/completelines.html
0
source to share