Grep regex NOT containing string

前端 未结 3 435
攒了一身酷
攒了一身酷 2020-12-12 12:33

I am passing a list of regex patterns to grep to check against a syslog file. They are usually matching an IP address and log entry;

grep "1         


        
3条回答
  •  温柔的废话
    2020-12-12 12:45

    (?

    You need to run this with -P to have negative lookbehind (Perl regular expression), so the command is:

    grep -P '(?

    Try this. It uses negative lookbehind to ignore the line if it is preceeded by 1.2.3.4. Hope that helps!

提交回复
热议问题