ssh $USR@$host /bin/bash <<\EOF >> 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/shiperror.log
EOF
I want to use an echo command within the EOF. Is this possible?
something like this: So that it prints the server name first and then awk command results to the ship-error.txt
ssh $USR@$host /bin/bash <<\EOF >> ship-error.txt
echo "Server Name: $host"
awk 'BEGIN{f=0} !f { s=$0; sub(/,.+/, "", s); gsub(/[-: ]/, " ", s); t=(systime()-mktime(s)); if(t<=14400) f=1 } f ' /logs/shiperror.log
EOF
but $host value doesnot appear.