How To Run AWK via Remsh?

Boy I hope someone can answer this question. I've been beating my head against the wall all day trying to come up with a solution.

I have a carrot delimited file that looks like this:
ANDERSON^678934^1974^BOB
JONES^564564345^1954^ABRAHAM
SMITH^47568465^1948^JON

If I run this command:
awk -F^ '{ if ($4 == "ABRAHAM") print $0 }' file.dat
...directly from the server where the file is located it works great.

But I really need to run it from a remote server so I rewrote it like this:
su userID -c 'remsh server -l local userID awk -F^ '{ if ($4 == "ABRAHAM") print $0 }' file.dat'

But when I do I get the error:
ksh: syntax error: `(' unexpected

I have tried other variations as well. Including: su userID -c 'remsh server -l local userID awk -F^ '$4~/^ABRAHAM$/' file.dat'
But this one gives the error message:
syntax error The source line is 1.
The error context is
>>> ~ <<<
awk: Quitting
The source line is 1.

...and even: su userID -c 'remsh server -l local userID awk -F^ '$4 == "ABRAHAM"{print $0}' file.dat'
And this one gives the error message:
syntax error The source line is 1.
The error context is
>>> == <<<
awk: Quitting
The source line is 1.

I'm really stuck. All these variations seem to work until I wrap it in the remsh syntax and then it just fails. If anyone can help point me in the right direction I'd be very grateful.

can you put the awk command in a script on the remote server and execute that script with remsh?

su userID -c remsh server -l local userID "awk -F^ '\$4 == \"ABRAHAM\"' file.dat"

This link might be helpful too:

http://www.unix.com/shell-programming-scripting/48206-how-execute-multiple-commands-via-ssh.html

Yes and no. It would probably work but the program that is already generating this command call does not create files with sufficient permissions to execute them. So that would require another step to chmod the file. Also, the return from the awk command needs to be output to a file on the local server so that would mean another two steps. One to generate it and a second to remsh it back to the local server. I'd like to avoid this if possible.

That almost got it.

It gives the error:
su: illegal option -- l
usage: remsh host [ -l login ] [ -n ] command

So I wrapped the remsh call in sinqle quotes (or ticks) as I have done in the past with this type of su to remsh call
su userID -c 'remsh server -l local userID "awk -F^ '\$4 == \"ABRAHAM\"' file.dat"'
...and it doesn't give an error but neither does it give any results at all.

But if I separated the command into two lines like this:
su userID -c
remsh server -l local userID "awk -F^ '\$4 == \"ABRAHAM\"' file.dat"
...and works for some reason. Which is fantastic but I'd really like to know how to get it all in one call if possible.

how about this? Does awk have to run remotely?

su userID -c "remsh server -l local userID cat file.dat" | awk -F^ '$4 =="ABRAHAM"'

I'll run some tests but I think catting the file and then running awk will be too slow. The file it's scanning is massive and the scans will be running a lot for varying requests. So speed is relatively important.