I need to find all processes that have in their names a number between 100 and 200 inclusive.
I tried
ps -ef | grep xclock -bw '[1-2][0-9][0-9]'
but that includes 299. How to suppress it and have only numbers up to 200?
I like to directly use proc for that
grep -l '1[0-9][0-9]\|200' /proc/[1-9]*/comm|awk -F '/' '{print $3}'
For the pid variant
grep -l 'xclock' /proc/{1[0-9][0-9],200}/comm 2>/dev/null|awk -F '/' '{print $3}'
grep '1[0-9][0-9]\|200'?|and instead is seen as theoroperator. And no problem, glad you got it sorted :)grepimplementation is that? With GNUgrep, that would search with byte offset thexclockword in the file called[1-2][0-9][0-9]. With all othergrepimplementations that I know, it would search forxclockin the-bwand[1-2][0-9][0-9]files.