filtering a numeric value which has '%' using awk

Hello Gurus,

I have a requirement where I have to filter a value from some field which has 99% or greater than '99%'..
For ex:
The Date (file -- sample.csv) will be like below

Field1,Field2,Field3,Field4
860440512,844284992,16155520,99%
860440512,844284992,16155520,94%
860440512,844284992,16155520,100%
860440512,844284992,16155520,99%
860440512,844284992,16155520,98%

Now I have to extract the values which has >= 99%... I have tried the below way...

 
cat sample.csv | awk -F',' '{if ( $3 < 5242880 || $4 >= "99%" ) print $1,$2,$3,$4}'

but as this is containing special charecter and numaric values, it is unable to satisfy the given numaric operator (>=)

Could anyone suggest me the way here pls?

Thanks in advance.

Regards,
VRN

hard to see your sample file....

awk -F',' '{if ( $3 < 5242880 || int($4) >= 99 ) print $1,$2,$3,$4}' sample.csv
 
bash-2.03$ cat sample.csv
Field1,Field2,Field3,Field4
860440512,844284992,16155520,99%
860440512,844284992,16155520,94%
860440512,844284992,16155520,100%
860440512,844284992,16155520,99%
860440512,844284992,16155520,98%
bash-2.03$ awk -F',' '{if ( int($4) >= 99 ) print $1,$2,$3,$4}' sample.csv
bash-2.03$

Seems it is not working... could you pls have a look at the above and suggest?

What OS are you using. If on Solaris try /usr/xpg4/bin/awk instead of awk

thanks much for the suggestion... It worked.... :slight_smile: