Prev: Posix fortran and the gnu toolchain
Next: Need help with awk regular expression to process chess games
From: Georg Klein on 11 Apr 2010 14:06 Hi all, Harry <simonsharry(a)gmail.com> wrote: > Hi, > > My intent here is to be able to look for fully upper-cased words only, > and filter out the rest. > I was, thus, expecting the following egrep to fail. > > $ echo "Abby" | egrep '^[A-Z]+$' > Abby > > But for some reason, egrep is able to match the extended regex for the > mixed-case input. > > Does anyone know what I'm missing here? > > Many thanks in advance, > /HS > > PS: > I'm using Gnu bash 4.0.23 and Gnu grep 2.5.3 on Fedora 11. Having read the thread, i think you did run into a egrep bug, that is fixed at least with 2.5.4. See http://savannah.gnu.org/bugs/?16179 for a similar problem. I am interested in this, because we have quite a lot of code relying on this, and I am glad to know that we do not have to change everything now. On systems with gnu grep version < 2.5.4 and >= 2.5 i have the following behavior: georg(a)ux4ever:~$ locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" [...] LC_ALL= georg(a)ux4ever:~$ egrep --version egrep (GNU grep) 2.5 georg(a)ux4ever:~$ echo "Abby" | egrep '^[A-Z]+$' Abby georg(a)ux4ever:~$ echo "ABBY" | egrep '^[A-Z]+$' ABBY georg(a)ux4ever:~$ echo 'The The' | egrep -i '(the) \1' .... and the last should return a result. On systems with egrep == 2.5.4 I get the following: georg(a)mediabox:~$ locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" [...] LC_ALL= georg(a)mediabox:~$ egrep --version GNU grep 2.5.4 georg(a)mediabox:~$ echo "Abby" | egrep '^[A-Z]+$' georg(a)mediabox:~$ echo "ABBY" | egrep '^[A-Z]+$' ABBY georg(a)mediabox:~$ echo 'The The' | egrep -i '(the) \1' The The .... which again shows the right (and expected) behavior. So it is worth to upgrade to a newer version of grep or to Fedora 12. hth -- Georg Take nothing too serious ...
From: Seebs on 11 Apr 2010 14:26 On 2010-04-11, Harry <simonsharry(a)gmail.com> wrote: > On Apr 11, 1:17�pm, Sidney Lambe <sidneyla...(a)nospam.invalid> wrote: >> I'll bet I've killfiled a score of your aliases already. >> I have most common first names killfiled. Missed "harry". >> Thanks. This way I eliminate every stinking troll using >> the name. > ??? Sidney is not particularly sane. He freaks out at people, killfiles them for being right when he was laughably wrong, and invents elaborate conspiracies to explain the fact that he keeps meeting new people who don't make him feel warm and fuzzy. Occasionally he says something interesting and topical about shell programming, but he's of marginal utility at best, because his answers are nearly always closely tied to his militant belief that anything that doesn't work precisely the way he first tried it is clearly an inferior piece of software designed by and for idiots. In short, keep one of those fifty-pound blocks of salt on hand if you're gonna read his posts[*]. -s [*] Because taking it with a grain of salt is unlikely to be strong enough. -- Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
From: Harry on 12 Apr 2010 01:28 On Apr 11, 11:06 pm, Georg Klein <n...(a)ux.ennuie.org> wrote: > Having read the thread, i think you did run into a egrep bug, that is fixed > at least with 2.5.4. See http://savannah.gnu.org/bugs/?16179 > hth > Georg > Take nothing too serious ... You're most definitely an angel, Georg! Can't tell you how terrible I was feeling about myself, having had to ask such a basic grep/regex question after having used it for years now. I was thinking that may be I'm getting too old and senile for programming :-( However, looks like, I could may be continue for few more years :-) I'm not being critical here, but I think that grep (and other such fundamentally important tools... that are verily the life and breath of *nix users/programmers) ought to be covered by automated regression testing... may be TDD style. grep is the perfect example of a program to which TDD could be applied successfully and tremendously fruitfully. (Note that I'm quite a sceptic when it comes to TDD's practicality in regular, real-world development/maintenance.) Thanks much.
From: Harry on 12 Apr 2010 01:28 On Apr 11, 11:06 pm, Georg Klein <n...(a)ux.ennuie.org> wrote: > Having read the thread, i think you did run into a egrep bug, that is fixed > at least with 2.5.4. See http://savannah.gnu.org/bugs/?16179 > hth > Georg > Take nothing too serious ... You're most definitely an angel, Georg! Can't tell you how terrible I was feeling about myself, having had to ask such a basic grep/regex question after having used it for years now. I was thinking that may be I'm getting too old and senile for programming :-( However, looks like, I could may be continue for few more years :-) I'm not being critical here, but I think that grep (and other such fundamentally important tools... that are verily the life and breath of *nix users/programmers) ought to be covered by automated regression testing... may be TDD style. grep is the perfect example of a program to which TDD could be applied successfully and tremendously fruitfully. (Note that I'm quite a sceptic when it comes to TDD's practicality in regular, real-world development/maintenance.) Thanks much.
First
|
Prev
|
Pages: 1 2 3 Prev: Posix fortran and the gnu toolchain Next: Need help with awk regular expression to process chess games |