Redirecting output to a local file after sshing

ssh $USR@$host /bin/bash  <<EOF
awk ' BEGIN{f=0} !f { s=$0; sub(/,.+/, "", s); gsub(/[-: ]/, " ", s); t=(systime()-mktime(s)); if(t<=14400) f=1 } f ' /home/error.log >> error.txt
EOF

We are trying to connect to a remote server through ssh and read values from error.log within last 4 hours.However, the output error.txt is created in the remote machine itself,but we wanted it in our local machine.

ssh $USR@$host /bin/bash  <<EOF > error.txt
awk ' BEGIN{f=0} !f { s=$0; sub(/,.+/, "", s); gsub(/[-: ]/, " ", s); t=(systime()-mktime(s)); if(t<=14400) f=1 } f ' /home/error.log
EOF

But we have 3 awk commands like this:

ssh $USR@$host /bin/bash  <<EOF
awk ' BEGIN{f=0} !f { s=$0; sub(/,.+/, "", s); gsub(/[-: ]/, " ", s); t=(systime()-mktime(s)); if(t<=14400) f=1 } f ' /logs/ship-error.log > ship-error.txt
awk ' BEGIN{f=0} !f { s=$0; sub(/,.+/, "", s); gsub(/[-: ]/, " ", s); t=(systime()-mktime(s)); if(t<=14400) f=1 } f ' /logs/inv-error.log > inv-error.txt
awk ' BEGIN{f=0} !f { s=$0; sub(/,.+/, "", s); gsub(/[-: ]/, " ", s); t=(systime()-mktime(s)); if(t<=14400) f=1 } f ' /logs/ord-error.log > ord-error.txt
EOF

In this case, how do we redirect .txt files to my local machine?

Sorry for not being a mind reader, but you only had one awk commaand!

scp the output files when your ssh is finished..

And please use code tags.