0

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

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by sbecker
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.