I have a perplexing sed question.
I want to parse the output of a script. The output is from the result of /sbin/service mysql status, which is rougly (in one case):
MySQL Running (12345)
I want to assign the PID to a variable, so that means piping to sed a couple of times and removing the .*( and ending ).* to strip it out. Easier said than done, as it turns out the stock Linux sed doesn't like using a wildcard expression such as: sed 's/.*\(//'
So I wonder if there is a more clever way to do this. Sure, I know where the PID file is, but the goal of this other script is to utilize the info that the redhat scripts already have access to (not reinvent the wheel).
Thanks.
I want to parse the output of a script. The output is from the result of /sbin/service mysql status, which is rougly (in one case):
MySQL Running (12345)
I want to assign the PID to a variable, so that means piping to sed a couple of times and removing the .*( and ending ).* to strip it out. Easier said than done, as it turns out the stock Linux sed doesn't like using a wildcard expression such as: sed 's/.*\(//'
So I wonder if there is a more clever way to do this. Sure, I know where the PID file is, but the goal of this other script is to utilize the info that the redhat scripts already have access to (not reinvent the wheel).
Thanks.