Assume the string is in parameter x then...
y=${x##*pid=}; echo ${y%%,*}
This is a way to do it without launching any additional processes.
(Note: There may be a way to nest these parameter expansions into one expression, but I don't know how to do that, if it's possible.)
@Pat
thanks I ll check the section