Simplify getpids function by using sed
Make getpids function fit on a single line