Re: Executing awk in a remote solaris server using ssh
- From: Cydrome Leader <presence@xxxxxxxxxxxxxx>
- Date: Thu, 25 Oct 2007 03:57:49 +0000 (UTC)
Karthik <v.karthick@xxxxxxxxx> wrote:
On Oct 24, 11:45 pm, and...@xxxxxxxxxxxxxxxxxxxx (Andrew Gabriel)
wrote:
In article <1193264211.792216.153...@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
Karthik <v.karth...@xxxxxxxxx> writes:
Hello Everybody,
I'm facing a weird problem with the awk command.
I'm trying to execute a simple awk command as follows,
echo 1 2 | awk '{print $2}'
This command prints the output 2.
When i try to execute the same command in a remote server using ssh as
follows,
ssh user@host <<HERE
echo 1 2 | awk '{print $2}'
HERE
The output i get is '1 2' instead of just 2.
Try:
cat <<HERE
echo 1 2 | awk '{print $2}'
HERE
and you'll see why.
However, you are not really using ssh correctly here.
You probably want something more like:
ssh user@host "echo 1 2 | awk '{print \$2}'"
although the shell escaping you require will depend slightly
on the shell you are using.
--
Andrew Gabriel
[email address is not usable -- followup in the newsgroup]
Thank you very much Andrew. It worked !!!!
In fact i was using the command - ssh user@host "echo 1 2 | awk
'{print $2}'" before i tried the command using the HERE tag.
Still, i'm trying to figure out why it works correctly when the AWK
command is put in a file and given as input to ssh without any escape
sequence.
heh, let me know if you find a way to do that.
passing $ chars with ssh is a fucking mess.
.
- References:
- Executing awk in a remote solaris server using ssh
- From: Karthik
- Re: Executing awk in a remote solaris server using ssh
- From: Andrew Gabriel
- Re: Executing awk in a remote solaris server using ssh
- From: Karthik
- Executing awk in a remote solaris server using ssh
- Prev by Date: Re: remote terminal : function keys do not work
- Next by Date: Re: VTOC destroyed by writing to slice?
- Previous by thread: Re: Executing awk in a remote solaris server using ssh
- Next by thread: Re: Executing awk in a remote solaris server using ssh
- Index(es):