ssh remote command

John Abreau john.abreau at zuken.com
Wed Oct 25 11:47:31 EDT 2006


You put the thing in double-quotes, which means the $2 in the awk 
command will be replaced by the shell on server1 while it parses 
the line. If you haven't run "set" in your command shell, then the 
$2 will be replaced by a null string, which turns the awk command 
into 

    awk '{ print }'


On Wed, 2006-10-25 at 11:31 -0400, Paul Baumgardner wrote:
> I'm trying to slurp some data out of a log file via ssh and I'm
> getting different results from ssh and doing it on the localhost.
> Both results are fine, though I'm curious as to why the output via ssh
> is different.
> 
> 
> [paul at server1 ~]$ ssh server2 "grep 'ORA-' /var/log/core.log | awk
> '{print $2}' | sort | uniq -c | sort -rn"
>      26 java.sql.SQLException: ORA-00001: unique constraint
> (SPRINT_CAMPAIGN.MO_C_USER_INTEREST_ENTRY_1) violated
>      18 java.sql.SQLException: ORA-00001: unique constraint
> (SPRINT_CAMPAIGN.MO_C_USER_INFO_1) violated [newbury at monitor ~]$
> 
> On the local host:
> 
> [paul at server2 ~]$ sudo grep 'ORA-' /var/log/core.log | awk '{print
> $2}' | sort | uniq -c | sort -rn
>      44 ORA-00001:
> [paulr at server2 ~]
> 
> Anyone have any ideas?  Is it something to do with the quotes in the
> command over ssh?
> 
> Thanks,
> Paul
> 
-- 
John Abreau
IT Manager
Zuken USA
238 Littleton Rd., Suite 100
Westford, MA 01886
T: 978-392-1777            F: 978-692-4725
M: 978-764-8934
E: John.Abreau at zuken.com  W: www.zuken.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.blu.org/pipermail/discuss/attachments/20061025/e7f4d4ec/attachment.sig>


More information about the Discuss mailing list