[nycbug-talk] two quick things

mikel king mikel.king at olivent.com
Thu Jan 5 20:34:33 EST 2012


On Jan 5, 2012, at 5:42 PM, Eitan Adler wrote:

> On Thu, Jan 5, 2012 at 5:37 PM, Matthew Story <matt at tablethotels.com> wrote:
>> Decided to share a slick hack to cut the grep program out of the ps resulsts that Jan sent my way as a bug report ... this goes against what I said in the talk about there not being a way to do this with only 1 invocation of grep ... and is slick as hell (total nifty(1) fodder):
> 
>> ps aux | grep "gre[p]"
> 
> or just use pgrep?
> 


Or just not use grep at all. 

I use this one to capture PIDs of interest. Like to ensure that my rsync job to a specific host has only one job at a time. Substitute what ever entity you are searching for between the $0's and let awk work it's magick.

ps ax | awk '$0~/rsync --stats -avzr /&&$0!~/awk/{print $1}'`


Regards,
Mikel King
BSD News Network
http://bsdnews.net
skype: mikel.king
http://twitter.com/mikelking



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.nycbug.org:8443/pipermail/talk/attachments/20120105/2179fc6f/attachment.htm>


More information about the talk mailing list