How to print only the digit in between a line in UNIX?

Below is my content in a file. How to print only the number in between CURDEPTH( ) ?? Please help me

5724-H72 (C) Copyright IBM Corp. 1994, 2011.  ALL RIGHTS RESERVED.
Starting MQSC for queue manager


     1 : dis ql(DUMMY.QUEUE) curdepth
AMQ8409: Display Queue details.
   QUEUE(DUMMY.QUEUE)
   TYPE(QLOCAL)                            CURDEPTH(1)
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.

It all depends what you are going to do with it. As an example this does:

perl -nle '/CURDEPTH\((\d+)\)/ and print $1' prince1987.file

Edit: Added a + to accommodate that a number could be more than one digit

1 Like