help with grep

Hi Folks, I am trying to create a report where I have to grep the number of CPU cores from the following output:

DEPENDENCY
    master=

CORE
    CID    CPUSET
    1      (8, 9, 10, 11, 12, 13, 14, 15)   --> CPU=first number from the left

VCPU
    VID    PID    CID    UTIL STRAND
    0      8      1      0.9%   100%
    1      9      1      1.1%   100%
    2      10     1      0.6%   100%
    3      11     1      0.8%   100%
    4      12     1      0.9%   100%
    5      13     1      0.8%   100%
    6      14     1      0.9%   100%
    7      15     1      0.6%   100%

How can I tell the command to look for the first number in the line below two lines from the line containing the word "CORE"?

I can get to that line containing core by

ldm ls-bindings | grep "CORE" 

How can I tell my command to look into the first number of the second line under the line containing the word core "CORE" :wall:

Momin

Hope this helps:

ldm ls-bindings | awk '/CORE/{getline;getline;print $1}'
1

Thanks a bunch... the output is still not the one I desire. I get this:

root# ldm ls-bindings | awk '/CORE/{getline;getline;print $1}'
0
1
2
3
4

any idea how this command can be tweaked?

What OS and shell are you using?

Try this:

awk 'NR==6{print $1}'

Thanks. I am using ksh on Solaris10
The output I get is:

# ldm ls-bindings | grep "^CORE" | awk 'NR==6{print $1}'
#

Also:

# ldm ls-bindings | grep "^CORE" | awk 'NR==2{print $1}'
CORE
# ldm ls-bindings | grep "^CORE" | awk 'NR==1{print $1}'
CORE
# ldm ls-bindings | grep "^CORE" | awk 'NR==3{print $1}'
CORE