Grep string

Hi,

Need help to grep string, actually out of string in not complete while grep using -w its not able to capture

db2pd -db VATPROD -reorg 

Table Reorg Stats:
Address            TableName          Start               End                 PhaseStart          MaxPhase   Phase      CurCount   MaxCount   Status  Completion
0x00007F61A25C0B80 ALERT              04/08/2017 13:14:53 04/08/2017 13:14:53 n/a                 n/a        n/a        0          0          Done    0
0x00007F61A25C5F80 ALERT_PROPERTIES   04/08/2017 13:15:15 04/08/2017 13:15:15 n/a                 n/a        n/a        0          0          Done    0
0x00007F61A2E2F580 HMON_ATM_INFO      04/09/2017 22:32:31 04/09/2017 22:32:31 n/a                 n/a        n/a        0          0          Done    0
0x00007F61A2480B80 APPCONNECTIONS     04/08/2017 12:41:15 04/08/2017 12:41:15 n/a                 n/a        n/a        0          0          Done    0
0x00007F61A2481880 TBSPACE_UTILIZATIO 04/09/2017 22:32:31 04/09/2017 22:32:31 n/a                 n/a        n/a        0          0          Done    0
0x00007F61A2483280 TBSPACE_CONT_UTILI 04/09/2017 22:32:32 04/09/2017 22:32:32 n/a                 n/a        n/a        0          0          Done    0
0x00007F61A267BD80 RECLAIM_STORAGE_IN 04/09/2017 22:32:31 04/09/2017 22:32:31 n/a                 n/a        n/a        0          0          Done    0
0x00007F61A25DA280 SQL_DIM            04/09/2017 22:32:31 04/09/2017 22:32:32 n/a                 n/a        n/a        0          0          Done    0
0x00007F61A46A1A80 LOCK_IDLETIME_STAT 04/08/2017 12:41:15 04/08/2017 12:41:15 n/a                 n/a        n/a        0          0          Done    0
0x00007F61A2EB0D00 DB2LUW_MONINDEX    04/08/2017 12:41:15 04/08/2017 12:41:15 n/a                 n/a        n/a        0          0          Done    0
0x00007F61A2EA0080 DB2LUW_MONTABLESPA 04/08/2017 12:41:15 04/08/2017 12:41:15 n/a                 n/a        n/a        0          0          Done    0
0x00007F61A25B4000 SQL_FACT           04/08/2017 12:41:15 04/08/2017 12:41:46 n/a                 n/a        n/a        0          0          Done    0

Full name of table is TBSPACE_CONT_UTILIZATION

db2pd -db VATPROD -reorg | grep -w TBSPACE_CONT_UTILIZATION  

shows no results

I can only pass variable as full, how to get below row using above grep command

0x00007F61A2481880 TBSPACE_UTILIZATIO 04/09/2017 22:32:31 04/09/2017 22:32:31 n/a                 n/a        n/a        0          0          Done    0

How about this:

db2pd -db VATPROD -reorg | grep -w "TBSPACE_CONT_UTIL.*"

or if you are trying to match both lines above how about:

db2pd -db VATPROD -reorg | grep -w "TBSPACE_.*UTIL.*" infile

hi chubler,

thanks for reply

Actually i m passing the table name as variable in script

but the output of

db2pd -db VATPROD -reorg

only show part of table name

igiving full table name

grep -w TBSPACE_CONT_UTILIZATION 

i want to grep only this row

0x00007F61A2481880 TBSPACE_UTILIZATIO 04/09/2017 22:32:31 04/09/2017 22:32:31 n/a                 n/a        n/a        0          0          Done    0

Alternatively with awk, try:

db2pd -db VATPROD -reorg | awk -v table=TBSPACE_CONT_UTILIZATION 'table~"^" $2' 

--
To get TBSPACE_UTILIZATION , use table=TBSPACE_UTILIZATION instead..

--
On Solaris use /usr/xpg4/bin/awk

--
@Chubler_XL : I don't think -w serves a purpose here

I removed it.