use o here-docs para contornar todas as desagradáveis citações de subshell:
ssh you@host <<-\SSH
awk -f 3<<\AWK /dev/fd/3
awk script
as many lines as you like
"$vars and quotes" are only evaluated by awk
#END
AWK
"$vars and quotes" are only evaluated by remote shell
echo 'single quotes and all'
rest of ssh script
#END
SSH