Using awk with rsh
Rick Poleshuck
rick at ulticorp.UUCP
Tue Jun 25 22:21:19 AEST 1991
In article <1991Jun19.143911.22217 at rodan.acs.syr.edu> mitanu at 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
More information about the Comp.unix.questions
mailing list