I want to capture all the lines that have the (XXXX) word before the last wordwhile xxxxx - is number /opt/OV/bin/opcagt -status scopeux     Perf Agent data collector                        (5102)   Running midaemon    Measurement Interface daemon                     (5110)   Running ttd         ARM registration daemon                                   Running perfalarm   Alarm generator                                  (5111)   Running agtrep      OV Discovery Agent                  AGENT,AgtRep (5520)   Running coda        OV Performance Core                 COREXT       (5529)   Running opcacta     OVO Action Agent                    AGENT,EA     (5427)   Running opcle       OVO Logfile Encapsulator            AGENT,EA     (5443)   Running opcmona     OVO Monitor Agent                   AGENT,EA              Running opcmsga     OVO Message Agent                   AGENT,EA     (5435)   Running opcmsgi     OVO Message Interceptor             AGENT,EA     (5553)   Running ovbbccb     OV Communication Broker             CORE         (5352)   Running ovcd        OV Control                          CORE         (5344)   Running ovconfd     OV Config and Deploy                COREXT       (5383)   RunningI try with /opt/OV/bin/opcagt -status | grep [0-9]but this grep syntax not capture the word before the last wordexpected results:scopeux     Perf Agent data collector                        (5102)   Runningmidaemon    Measurement Interface daemon                     (5110)   Runningperfalarm   Alarm generator                                  (5111)   Runningagtrep      OV Discovery Agent                  AGENT,AgtRep (5520)   Runningcoda        OV Performance Core                 COREXT       (5529)   Runningopcacta     OVO Action Agent                    AGENT,EA     (5427)   Runningopcle       OVO Logfile Encapsulator            AGENT,EA     (5443)   Runningopcmsga     OVO Message Agent                   AGENT,EA     (5435)   Runningopcmsgi     OVO Message Interceptor             AGENT,EA     (5553)   Runningovbbccb     OV Communication Broker             CORE         (5352)   Runningovcd        OV Control                          CORE         (5344)   Runningovconfd     OV Config and Deploy                COREXT       (5383)   Running
grep + regular expression to match word that located before the last word
text processing;sed;awk;grep;perl
try/opt/OV/bin/opcagt -status |  awk 'NF>2 && $(NF-1) ~ /\([0-9]*\)/ 'where$(NF-1) match before last field~ ask awk to do a pattern matching/\([0-0]*\)/ pattern is (, any number of digit and ) (you can use [0-9][0-9]* to have at least one.default action is to print.