11-03-2011 01:08 AM
Does anyone know how to display next line of grep-matched line?
grep command does not have -A parameter???
I need cluster package name and status, but don't know its name, status, node...
So, I want to get 2 lines from output of following cmviewcl -v .
PACKAGE STATUS STATE AUTO_RUN NODE <--this line and
mypackage up running enabled mynode <--this line
11-03-2011 01:49 AM - edited 11-03-2011 01:53 AM
gnu grep has a -A1 option to get the next line.
Or you can use sed or awk to find then print the next line.
11-03-2011 08:31 AM
Yes, GNU grep has the -A option, but HP-UX standard grep does not have it.
Which version of Serviceguard are you talking about?
At least on Serviceguard A.11.17 and newer, you can get the output in a different, machine-parseable format:
cmviewcl -f line -v
This output format might be easier to use in your own scripts.
11-03-2011 10:41 AM
> Yes, GNU grep has the -A option, but HP-UX standard grep does not have it.
Yes, HP-UX standard grep does not have it, but GNU grep is available for HP-UX.