Re: [CentOS] ssh remote execute awk problem

2011-03-17 Thread sheraz naz
From: Nico Kadel-Garcia To: CentOS mailing list Sent: Thu, March 17, 2011 6:31:15 AM Subject: Re: [CentOS] ssh remote execute awk problem >> grep ^processor /proc/cpuinfo | wc -l >> Or: >> ssh -l $TARGETUSER $TARGETHOST "

Re: [CentOS] ssh remote execute awk problem

2011-03-17 Thread Les Mikesell
On 3/17/2011 9:43 AM, m.r...@5-cent.us wrote: > >>> >>>ssh -l $TARGETUSER $TARGETHOST "[ -e /proc/cpuinfo ] -a grep >>> ^processor | wc -l" >> >> Or, more extremely - if you are doing much of this kind of remote >> inventory checking, you might consider running ocsinventory-ng with >> agent

Re: [CentOS] ssh remote execute awk problem

2011-03-17 Thread m . roth
Les Mikesell wrote: > On 3/17/2011 8:31 AM, Nico Kadel-Garcia wrote: >> >>> Quote the whole command and backslash the command quotes... >>> ssh root@localhost "awk '/processor/{count[\"proc\"]++}; END{print >>> count[\"proc\"] } ' /proc/cpuinfo" >> >> Or do the processing locally and stay away from

Re: [CentOS] ssh remote execute awk problem

2011-03-17 Thread Les Mikesell
On 3/17/2011 8:31 AM, Nico Kadel-Garcia wrote: > >> Quote the whole command and backslash the command quotes... >> ssh root@localhost "awk '/processor/{count[\"proc\"]++}; END{print >> count[\"proc\"] } ' /proc/cpuinfo" >> >> JD > > Or do the processing locally and stay away from proc nuttiness, >

Re: [CentOS] ssh remote execute awk problem

2011-03-17 Thread Nico Kadel-Garcia
On Thu, Mar 17, 2011 at 9:31 AM, Nico Kadel-Garcia wrote: > On Thu, Mar 17, 2011 at 6:58 AM, John Doe wrote: >> From: sync >>>There is a problem on executing awk command to remote servers; >>>    1. #!/bin/sh >>>    2. >>>    3. _CMD="ssh root@localhost" >>>    4. >>>    5. cpu_num="$($_CMD awk

Re: [CentOS] ssh remote execute awk problem

2011-03-17 Thread Nico Kadel-Garcia
On Thu, Mar 17, 2011 at 6:58 AM, John Doe wrote: > From: sync >>There is a problem on executing awk command to remote servers; >>    1. #!/bin/sh >>    2. >>    3. _CMD="ssh root@localhost" >>    4. >>    5. cpu_num="$($_CMD awk '/processor/{count["proc"]++}; END{print >>count["proc"]}' /proc/cpu

Re: [CentOS] ssh remote execute awk problem

2011-03-17 Thread John Doe
From: sync >There is a problem on executing awk command to remote servers; >1. #!/bin/sh >2. >3. _CMD="ssh root@localhost" >4. >5. cpu_num="$($_CMD awk '/processor/{count["proc"]++}; END{print >count["proc"]}' /proc/cpuinfo)“ >6. >7. echo $cpu_num Quote the whole c

[CentOS] ssh remote execute awk problem

2011-03-17 Thread sync
Hi , all : There is a problem on executing awk command to remote servers; The shell test script is like this : 1. #!/bin/sh 2. 3. _CMD="ssh root@localhost" 4. 5. cpu_num="$($_CMD awk '/processor/{count["proc"]++}; END{print count["proc"]}' /proc/cpuinfo)“ 6. 7. echo $c