Using awk with rsh

Suresh Padmanabhan suresh at uts.amdahl.com
Sat Jun 22 06:17:09 AEST 1991


In article <1991Jun19.143911.22217 at rodan.acs.syr.edu>, mitanu at goedel.top.cis.syr.edu (Mitanu Paul) writes:
> 
> I have tried to use awk with rsh, 
> 	rsh spica "ps -l | awk '{ print $4}'"
> and here is what I get:
> 
>        F UID   PID  PPID CP PRI NI  SZ  RSS WCHAN    STAT TT  TIME COMMAND
> 20488200 109  2548  2547  1  15  0  96    0 kernelma IW   pc  0:00 -csh (csh)
> 20008000 109  2599  2548  0   1  0 292    0 select   IW   pc  0:05 emacs p2.pl
> 
> Question:
> Is this a bug of awk or that of rsh? Is there something which I am missing?

You ARE missing something. The trick is to hide the metacharacters from the
shell at the server end . Try the following syntax :

           remsh spica "ps -ef| awk '{print \$4}'"

Hope this helps.


*****************************************************************************
Suresh Padmanabhan              (suresh at uts.amdahl.com)
Amdahl Corp.                    Phone:(408)737-5738
*****************************************************************************
-- 
*****************************************************************************
Suresh Padmanabhan              (suresh at uts.amdahl.com)
Amdahl Corp.                    Phone:(408)737-5738
*****************************************************************************



More information about the Comp.unix.questions mailing list