Problem with calculations

grep Quality abc.txt | awk -F"=" '{print $2}'

[/CODE]

o/p is given as

70/70
49/70

I want in the below format (percentage format)

100%
70%

help me!!!!:confused::confused::confused:

---------- Post updated at 09:59 AM ---------- Previous update was at 09:57 AM ----------

Cell 01 - Address: BC:F6:85:4D:DB:97
Channel:9
Frequency:2.452 GHz (Channel 9)
Quality=70/70
Signal level=-22 dBm
Encryption key:on
ESSID:"AANCH_DLINK"
Cell 01 - Address: BC:F6:85:4D:DB:97
Channel:9
Frequency:2.452 GHz (Channel 9)
Quality=40/70
Signal level=-30 dBm
Encryption key:on
ESSID:"link_AP"

content of abc.txt

try:

grep Quality abc.txt | awk -F"[=/]" '{printf( "%d%%\n", ($2/$3)*100) }'
1 Like

thank you :slight_smile:

---------- Post updated at 10:24 AM ---------- Previous update was at 10:23 AM ----------

sorry i forgot to include this question... :stuck_out_tongue:
how do i replace the current o/p with the older one in abc.txt file...???

try:

awk -F"[=/]" '/Quality/ {$0=sprintf( "%s=%d%%\n", $1,($2/$3)*100) }1' abc.txt
1 Like