Artificial intelligent assistant

how to reterive the value present within the brackets I need to retrieve the number which is present in bracket only with total comamnd line. For ex: $ cat exa.lg 02:57:25 BROKER : Unable to open errno =. (1295) 02:57:25 BROKER 1: Unable to open (45) 02:57:25 BROKER 1: Unable to open 999. (13) 02:57:25 BROKER : Unable to open 1295, (1098) I need to get the information for error number `1295` which is in the brackets, not in the command line (`BROKER : Unable to open 1295`) I tried with this: cat exa.lg | awk -F '[)(]' '{print $2}' | grep -E '1295|13' exa.lg 02:57:25 BROKER : Unable to open errno =. (1295) 02:57:25 BROKER 1: Unable to open 999. (13) 02:57:25 BROKER : Unable to open 1295, (1098) But I am getting both `1295` numbers (including the one in `02:57:25 BROKER : Unable to open 1295`). I want to fetch only `02:57:25 BROKER : Unable to open errno =. (1295)`. How can I do this?

Include the parentheses in your regular expression. You need to escape them since they have special meaning in regexp.


grep -E '\((1295|13)\)' exa.lg

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 6283974f8d746dba6eedb44caf0f1302