Question: I have a file (my\_file) and want to count how many values in column 11 have value < .05:

I try:

```
echo $($(cat my_file | cut -f 11 | awk '$1 < 5E-2'  | wc -l) / $(cat my_file | cut -f 11 |  wc -l))

```

I get `1158532: command not found`

Could anyone please help me see where I am wrong?

Answer: 
> 
> Count precent of lines that pass AWK filter?
> 
> 
> 

I would harness GNU `AWK` for this task following way, let `file.txt` content be

```
0.01
0.03
0.05
0.07
0.09

```

then

```
awk '{cnt+=$1<0.05}END{print cnt/NR*100 "%"}' file.txt

```

gives output

```
40%

```

Explanation: comparison gives 0 or 1, so I use `+=` which increase by 0 when condition not met and increase by 1 when condition holds. After all lines processed I compute percentage simply by dividing cnt by NR (which is inside END is number of all lines) and multiply by `100`. **Disclaimer**: this solution assumes that `file.txt` has no less than 1 line.

*(tested in gawk 4.2.1)*
```
{m,g}awk '
BEGIN {        ___=((_+=++_+_)*_+(\
           __=_*_+—-_) )^-!(_ -= _) 
} {  _+=+($__)<___ 
} END {

    printf("\n\n\tFilter hit rate :: %.*f %% ( %\47.f / %\47.f )"\
           " \n\n\t%*sFile :: %-.*s \n\n",
                    ___=__--,__*_*__/(__=NR),_,__,
             ___,____,_^=_*=_+=_^=_<_, FILENAME) } ' my_file

```

|

```
Filter hit rate :: 0.04415484271 % ( 3,588 / 8,125,949 )   

           File :: myfile 

```