I am using the below code to return the pid. But it works only if the pid is 4-digit. It returns nothing if the pid is 5-digit (see the examples). How do I fix this code for both the instances. Thanks in advance!
Mamtha
pid =ps -fu truecomp | grep TrueCompGrid | cut -d " " -f3
$ ps -aef |grep TrueCompGrid
truecomp 3236 3176 0 13:10:07 pts/10 0:00 /bin/sh ./TrueCompGrid runPipeline calendar=Main Monthly Calendar stage=Validat
$ ps -fu truecomp | grep TrueCompGrid | cut -d " " -f3
3236
$ ps -fu truecomp | grep TrueCompGrid
truecomp 3411 3176 0 13:14:25 pts/10 0:00 /bin/sh ./TrueCompGrid runPipeline calendar=Main Monthly Calendar stage=Validat
$ ps -fu truecomp | grep TrueCompGrid | cut -d " " -f3
3411
$ ps -fu truecomp | grep TrueCompGrid
truecomp 26853 3176 0 13:18:42 pts/10 0:00 /bin/sh ./TrueCompGrid runPipeline calendar=Main Monthly Calendar stage=Validat
$ ps -fu truecomp | grep TrueCompGrid | cut -d " " -f3