awk - help with "|" as "or" and syntax - TechRepublic
General discussion
December 18, 2003 at 05:41 AM
cpfeiffe

awk – help with “|” as “or” and syntax

by cpfeiffe . Updated 22 years, 5 months ago

I have an awk statement on my log server that discards ignorable data and emails the rest once a day. The statement is

awk ‘! /\.debug\]/ && ! /\.info\]/ && ! ……

I want to combine the .debug] and .info] matches in one expression with or so I tried

awk ‘! /[\.debug\]|\.info\]]/ && ! ……

This doesn’t seem to work. I was able to a simpler join as follows

&& ! /wally updater/ && ! /dilbert updater/ && ! ……

rewritten as

&& ! /[wally|dilbert] updater/ && ! ……

Any ideas why it isn’t working with the first expression set?

This discussion is locked

All Comments