Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mac OSX, Bash, awk, and negative look behind

I want to find a particular process using awk:

ps aux|awk '/plugin-container.*Flash.*/'

Now it finds the process, but it includes itself in the results, because ps results include them as well. To prevent that, I am trying to use negative look behind as follows:

ps aux|awk '/(\?<!awk).*plugin-container.*Flash.*/'

But it does not work. Does awk support look behind? What am I doing wrong? Thanks

like image 962
Loke Avatar asked Jan 17 '23 17:01

Loke


1 Answers

The common trick is to use

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

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

like image 92
choroba Avatar answered Jan 20 '23 05:01

choroba