The best answer to this is to probably get rid of the ssh .... | grep ... line, and modify the awk script in the other command to add the functionality you were getting from the grep command...
That will get rid of any interleaving issues as a bonus side-effect.