I need to calculate the median in the fastq file, how can I do this with awk or bioawk?
with seqkit 

    $ seqkit stats -a test.fq

In output, Q2 is median value.  If you want to extract fastq name, and median, try 

    $ seqkit stats test.fq -aT | cut -f1,10

with awk and st (available in brew, conda):

    $ awk 'NR % 4==2 {print length ($1)}' hcc1395_tumor_rep1_r1.fastq |st --summary
   
     min	q1	median	q3	max
        151	151	151	151	151
 
    $ awk 'NR % 4==2 {print length ($1)}' hcc1395_tumor_rep1_r1.fastq |st --median 
    151

Ministat is available in system repos for many GNU-Linux and BSD distros and you can try:

    $ awk 'NR % 4==2 {print length ($1)}' hcc1395_tumor_rep1_r1.fastq | ministat -A |tr -s " "| cut -f5 -d " "
    
    Median
    151