Redo the script in gawk