Re: egrep oddity



On 2012-02-05 22:31 +0100, Tomas Volka wrote:

On Ne 05-02-12 | 16:03, Neal Murphy wrote:
For quite some time now, I've been getting peeved with egrep not doing what it
should.

I have Squeese installed and up-to-date. In an xterm running bash or on a
console running bash or dash, this command:
ls -C1 | egrep "^[A-Z]"
returns all lines except those beginning with 'a'. Even the following commands
exhibit similar behavior:
alias|sed -e 's/^a/b/'|egrep "^[A-Z]" # passes sed's output untouched
alias|sed -e 's/^a/A/'|egrep "^[A-Z]" # passes sed's output untouched

These commands behave the same way on another Squeeze installation at another
location. Also, 'grep -E' behaves the same way.

The commands behave as expected on a different GNU/Linux system.

Does anyone else see this behavior? Or do I need to clean my pipe and smoke
something better?

Thanks,
N

The "^[A-Z]" range will never match line beginning with a, since the range
matches only uppercase characters.

Not quite true, this very much depends on the locale.

Sven


--
To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx
with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx
Archive: http://lists.debian.org/87pqdt7x8x.fsf@xxxxxxxxxxxxx



Relevant Pages

  • Re: egrep oddity
    ... console running bash or dash, ... The commands behave as expected on a different GNU/Linux system. ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)
  • Re: egrep oddity
    ... console running bash or dash, ... These commands behave the same way on another Squeeze installation at another ... The commands behave as expected on a different GNU/Linux system. ... this very much depends on the locale. ...
    (Debian-User)
  • Re: egrep oddity
    ... console running bash or dash, ... These commands behave the same way on another Squeeze installation at another ... The commands behave as expected on a different GNU/Linux system. ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)
  • Re: [opensuse] Why are there not more using Linux?
    ... With thanks to all who've made this what it is, and with continuing faith that one day it'll be what it deserves to be, and have the acceptance and mainstream support it deserves. ... I recently bought a VIC 20, which was my first computer. ... To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx ... For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx ...
    (SuSE)
  • Re: [opensuse] HP Pavilion DV6000 No Microphone input
    ... Only the microphone input, needed with Skype, doesn't work. ... To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx ... For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx ... I fired up a KDE app called Kmix. ...
    (SuSE)