Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!ulticorp!rick From: rick@ulticorp.UUCP (Rick Poleshuck) Newsgroups: comp.unix.questions Subject: Re: Using awk with rsh Keywords: awk, rsh Message-ID: <503@ulticorp.UUCP> Date: 25 Jun 91 12:21:19 GMT References: <9105241726.AA16913@?lri.uwo.ca> <49494@ut-emx.uucp> <1991Jun19.143911.22217@rodan.acs.syr.edu> Reply-To: rick@ulticorp.UUCP (Rick Poleshuck) Organization: The Ultimate Corp., East Hanover, NJ Lines: 32 In article <1991Jun19.143911.22217@rodan.acs.syr.edu> mitanu@top.cis.syr.edu (Mitanu Paul) writes: >Hi, > >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 > > I suspect that you have solved this problem already, but here is the line that you meant to type, anyway. rsh spica "ps -l | awk '{ print \$4}'" Your problem was in your understanding of the local shell and how it handles quotes and double quotes. You assumed that because the $4 was inside single quotes the local shell would leave it alone, however, the single quotes were surrounded by double quotes and lost any special meaning. Try this example: echo "'$0'" The $0 is expanded by /bin/sh because the single quotes are quoted. -- | Email - !uunet!ulticorp!ultixrs!rick Rick Poleshuck | Voice - (201) 887-9222 Ext. 3755 | Mail - The Ultimate Corporation, East Hanover, NJ 07936