[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

RE: [rhelv5-list] Regular Expressions on RHEL 5



Happy to help... 

-----Original Message-----
From: rhelv5-list-bounces redhat com
[mailto:rhelv5-list-bounces redhat com] On Behalf Of Ian Lists
Sent: Wednesday, December 26, 2007 2:10 PM
To: Red Hat Enterprise Linux 5 (Tikanga) discussion mailing-list
Cc: Red Hat Enterprise Linux 5 (Tikanga) discussion mailing-list
Subject: Re: [rhelv5-list] Regular Expressions on RHEL 5

Thanks, it seems to be working now after I adjusted my grep query like
you suggested.  I am using bash on everything, and I don't think there
has been to many changes from EL4 to EL5.

Thanks again,
Ian



----- "Kevin Collins [MindWorks]" <KCollins chevron com> wrote:
> Your regular expression is not very good:
> 
> egrep -q '[Nn]ot\ [retrieving|Found]'
>                 ^
> 
> You are quoting the string, so why are you escaping the space?
> 
> egrep -q '[Nn]ot\ [retrieving|Found]'   
>                    ^^^^^^^^^^^^^^^^ 
> 
> This matches any of one the characters listed, NOT the strings
> "retrieving" or "Found" - for that, you would want something like:
> 
> egrep -q '[Nn]ot (retrieving|Found)'
> 
> Third, you are telling the shell "if this command (egrep -q ...)
> returns
> a successful return code, then exit (&& exit). So, how do you know
> what
> the reurn code is? The "-q" tells egrep to print nothing, so you
> would
> not see any difference.
> 
> Which shell are you using? Korn shell (ksh) changed between RHEL4 and
> RHEL5 from pdksh to actual Korn shell... could be that pipelines have
> slightly different behavior.
> 
> Kevin
> 
> -----Original Message-----
> From: rhelv5-list-bounces redhat com
> [mailto:rhelv5-list-bounces redhat com] On Behalf Of Ian Lists
> Sent: Wednesday, December 26, 2007 1:43 PM
> To: rhelv5-list redhat com
> Subject: [rhelv5-list] Regular Expressions on RHEL 5
> 
> I have a strange situation where a script that works on RHEL 4 and
> Fedora 8 doesn't work with RHEL5.  The piece of the script that is
> failing is very simple, it's just a wget with grep.
> wget -N --no-check-certificate https://myserver.net/file.txt  2>&1
> >/dev/null  | egrep -q '[Nn]ot\ [retrieving|Found]' && exit
> 
> It doesn't seem to care about matching the grep results on RHEL5, it
> just always exits.  The script should just continue on if it doesn't
> get
> a hit on the grep statement. Anyone have any suggestions?
> 
> Thanks,
> Ian
> 
> 
> _______________________________________________
> rhelv5-list mailing list
> rhelv5-list redhat com
> https://www.redhat.com/mailman/listinfo/rhelv5-list
> 
> _______________________________________________
> rhelv5-list mailing list
> rhelv5-list redhat com
> https://www.redhat.com/mailman/listinfo/rhelv5-list

_______________________________________________
rhelv5-list mailing list
rhelv5-list redhat com
https://www.redhat.com/mailman/listinfo/rhelv5-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]