1753797 Members
7161 Online
108799 Solutions
New Discussion юеВ

Re: Help with awk Script

 
SOLVED
Go to solution
Scott Frye_1
Super Advisor

Help with awk Script

I want to use awk on my data. Here are two lines (of several) to represent the data I have.

One month ago: Sep29 100% (10%) <---- *HIGH*
One week ago: Oct22 100% (-2%) <---- *HIGH*

I want the number in parentheses without the '%' but with the '-'.

Any help would be appreciated.

Thanks

Scott
2 REPLIES 2
Sanjay_6
Honored Contributor
Solution

Re: Help with awk Script

Hi Scott,

assume the file is /tmp/test

cat /tmp/test
One month ago: Sep29 100% (10%) <---- *HIGH*
One week ago: Oct22 100% (-2%) <---- *HIGH*

Try this,

cat /tmp/test |tr -d "()"|cut -f 2 -d "%"

this will give you the output.

10
-2

Hope this helps.

Regds
Scott Frye_1
Super Advisor

Re: Help with awk Script

works like a charm!

Thanks