Hi,
I have a file which computes fields number and some column produced "nan"
I would like to convert the "nan" value to 0 basically.
q=`echo $i $j |awk '{printf("%f",($2/($1+$2)))}'
The above is the command which I use for computation. However, I would
like to check if $1 and $2 is 0, it will return 0 and echo as q=0 rather than nan.
Besides, I would like to know how can we check nonexistence element from grep
k=`grep -n " $char"'$'"" a.txt.txt|tr ":" " "|awk '{print $1}'
Above is the command which I used to grep and check a value of first field element. However, I would like to check if the grep returns me 0 (none found), it would print a constant value of 1000 let say.
Please help. Thanks.
-Jason