From: Janis Papanagnou on
robertchen117(a)gmail.com wrote:
> I have a file, like this:
>
> host1 52233
> host2 failed scan
> host3 2333
>
> I want to get all these second column is a digital number and biger
> than 50000, please let me how to do it.
>
> if I use the following command, it will get "failed" hosts also.
> cat host_file | nawk '{if($2 >=50000){print $1, $2}}'
>
> So how to check if the column is a digital number...? Please help me.

Mind that cat is unnecessary in the shell context, and the if's are
unnecessary in awk in such contexts. To fix your failed line assure
that awk does a numerical comparison (instead of a lexicalic) by
converting the field explicitly to a number.

awk '0 + $2 >= 50000 {print $1, $2}' hostfile


Janis