# Stupid awk tricks

From Rizzo_Lab

Grep out the wallclock time from the namd out files, convert to hours and adds them together.

grep "WallClock:" *.out | awk '{sum+=$2/3600} END {print "Hours="sum}'

Same thing, but now also does mean and sd

awk '{sum+=$2/3600; n+=1; sumsq+=($2/3600)^2} END {print "SD="sqrt(sum^2-sumsq)/(n+1),"Mean="sum/n}'

correction

awk -F, '{mean+=$94/5000; n+=1; meansq+=(($94^2)/5000)} END {print "SD="sqrt(meansq - mean^2),"Mean="mean}'

Theoretical success rate i.e. at least one pose in mol2 file with RMSD<=2

awk '/RMSD:/{if($3<=2.0)ths=1}END{print ths}' scored.mol2

Return lowest EMSD in mol2 file

awk 'BEGIN{lrm=99}/RMSD:/{if($3<=lrm)lrm=$3}END{printf"%.2f",lrm}' mol2file

## Lowest DOCK RMSD in MOL2 output

grep RMSD mol_scored.mol2 | awk '{print $3}' | sort -n | head