#!/usr/bin/gawk -f BEGIN { FS = OFS = ","; FileName = "rawResults"; } NF==10 { Got = $(NF-1); Want = $(NF); Re = (Got-Want)/Want; print Re >> FileName; }