From: GRP on
hi

would like to have a quick fix for the below one which is throwing
error

-------------------------------excerpt-------------------
RDIR=/data1/logs
TODAY="`date '+%b %d'`"
ssh -i $userid@$host "grep -il "ERROR" `ls -l $RDIR|grep "$TODAY" |awk
'{print $NF}'` 2>/dev/null|wc -l"
-------------------------------excerpt-------------------

throws below err

ksh: 27: not found
grep: RE error 41: No remembered search string.

will try to get the number of files which has the pattern "ERROR"
from the directory ($RDIR) in today's date files from remote server.
From: Michael Paoli on
On Apr 27, 4:49 am, GRP <rengaprasath(a)gmail.com> wrote:

> would like to have a quick fix for the below one which is throwing
> error
>
> -------------------------------excerpt-------------------
> RDIR=/data1/logs
> TODAY="`date '+%b %d'`"
> ssh -i $userid@$host "grep -il "ERROR" `ls -l $RDIR|grep "$TODAY" |awk
> '{print $NF}'` 2>/dev/null|wc -l"
> -------------------------------excerpt-------------------
>
> throws below err
>
> ksh: 27:  not found
> grep: RE error 41: No remembered search string.
>
> will try to get the number of files which has the pattern "ERROR"
> from the directory ($RDIR)  in today's date files from remote server.

Would help to know what you're attempting to do.

But if we guess/presume:
RDIR is directory location ssh server
.... and make some other guesses/presumptions on what you want, perhaps
something like:

RDIR=/data1/logs
TODAY="`date '+%b %d'`"
ssh -i "$userid@$host" '
grep -il ERROR `
ls -l '\'''"$RDIR"''\'' |
grep '\'''"$TODAY"''\'' |
awk '\''{print $(NF);};'\''
` 2>/dev/null |
wc -l
'
From: Bill Marcum on
On 2010-04-27, GRP <rengaprasath(a)gmail.com> wrote:
> hi
>
> would like to have a quick fix for the below one which is throwing
> error
>
> -------------------------------excerpt-------------------
> RDIR=/data1/logs
> TODAY="`date '+%b %d'`"
> ssh -i $userid@$host "grep -il "ERROR" `ls -l $RDIR|grep "$TODAY" |awk
> '{print $NF}'` 2>/dev/null|wc -l"

Change the double quotes, execpt for the first and last ones, to \".

From: Michael Paoli on
On Apr 27, 7:47 am, Bill Marcum <marcumbill(a)bellsouth.net> wrote:
> On 2010-04-27, GRP <rengaprasath(a)gmail.com> wrote:
>
> > would like to have a quick fix for the below one which is throwing
> > error
>
> > -------------------------------excerpt-------------------
> > RDIR=/data1/logs
> > TODAY="`date '+%b %d'`"
> > ssh -i $userid@$host "grep -il "ERROR" `ls -l $RDIR|grep "$TODAY" |awk
> > '{print $NF}'` 2>/dev/null|wc -l"
>
> Change the double quotes, execpt for the first and last ones, to \".

But that would still leave the command substitution executed locally
on
the ssh client system - which I'm presuming isn't what is intended.

elsethread <news:42ad8d71-
acc0-4e04-8053-824ca0925384(a)v14g2000yqb.googlegroups.com>,
I suggested:
> RDIR=/data1/logs
> TODAY="`date '+%b %d'`"
> ssh -i "$userid@$host" '
>  grep -il ERROR `
>   ls -l '\'''"$RDIR"''\'' |
>   grep '\'''"$TODAY"''\'' |
>   awk '\''{print $(NF);};'\''
>  ` 2>/dev/null |
>  wc -l
> '