Mac OSX, Bash, awk, and negative look behind Mac OSX, Bash, awk, and negative look behind bash bash

Mac OSX, Bash, awk, and negative look behind


The common trick is to use

ps aux | grep '[p]lugin-container.*Flash.*'

The character class [p] prevents grep itself from being matched.


I don't know whether awk supports lookbehind, but I usually solve this problem with grep -v:

aix@aix:~$ ps aux | awk '/plugin-container.*Flash/' | grep -v awk

(Also, I'd normally use grep for the awk command above.)


I don't know if awk supports lookbehinds, but if, then the question mark at the start should not be escaped, a negative lookbehind starts (?<!

A question mark right after the opening bracket is the sign, that this group is not a capturing group, i.e. it has some special meaning.