Simple Awk question

I need to just pull the information in in the parenthesis

QUEUE(ESB_CYV_ALERT_ERROR_Q)
QUEUE(ESB_CYV_ALERT_Q)

I used awk but this is all considered 1 column. When I parse down this information...

QUEUE(ESB_CYV_ALERT_ERROR_Q)      TYPE(QLOCAL)
QUEUE(ESB_CYV_ALERT_Q)            TYPE(QLOCAL)
QUEUE(ESB_ENROLL_ERROR_Q)         TYPE(QLOCAL)

I used
awk '{print $1}'

I get the following

QUEUE(ESB_CYV_ALERT_ERROR_Q)
QUEUE(ESB_CYV_ALERT_Q)
QUEUE(ESB_ENROLL_ERROR_Q)

I just need the information inside the parenthesis so I can pipe it into a variable to use elsewhere.



INT_sysengAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TommySzalapskiCommented:
AWK supports regular expressions so try adding
(?<=QUEUE\().*(?=\))
Should extract the strings in the parentheses. Works here http://www.gskinner.com/RegExr/
0
INT_sysengAuthor Commented:
What would would be the entire command?
0
TommySzalapskiCommented:
I think it would be:
awk '/(?<=QUEUE\().*(?=\))/ {print $1}'
I tried to post this a while ago but the site had an error.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

arnoldCommented:
awk ran by itself uses white space as the separator.
Could you post what output you want?

awk -F\)  ' { print $1 } ' | awk -F\(  ' {print $2 } '

The problem is that if there are two groups as your example point it will miss the second set of data.
0
INT_sysengAuthor Commented:

This is the information I have
QUEUE(ESB_CYV_ALERT_ERROR_Q)      TYPE(QLOCAL)
QUEUE(ESB_CYV_ALERT_Q)            TYPE(QLOCAL)




That is the desired output.

ESB_CYV_ALERT_ERROR_Q
ESB_CYV_ALERT_Q



0
INT_sysengAuthor Commented:
Here is what I have


[mqm@chvm01 ~]$ echo "display  ql(ESB*)  MAXDEPTH" | runmqsc intxqmtest | grep QUEUE
   QUEUE(ESB_CYV_ALERT_ERROR_Q)            TYPE(QLOCAL)
   QUEUE(ESB_CYV_ALERT_Q)                  TYPE(QLOCAL)
   QUEUE(ESB_ENROLL_ERROR_Q)               TYPE(QLOCAL)



I need to get

ESB_CYV_ALERT_ERROR_Q
ESB_CYV_ALERT_Q
ESB_ENROLL_ERROR_Q



0
TommySzalapskiCommented:
Did it work to run this?
awk '/(?<=QUEUE\().*(?=\))/ {print $1}'
0
INT_sysengAuthor Commented:
Negative that did not give any output.

0
arnoldCommented:
Run my script, it should work
cat file | awk -F\)  ' { print $1 } ' | awk -F\(  ' {print $2 } '
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.