case conversion in sed substitution does not work

Matt Zimmerman mdz at canonical.com
Fri Nov 12 23:59:59 UTC 2004


On Fri, Nov 12, 2004 at 03:46:39PM -0800, Matt Zimmerman wrote:
> On Wed, Nov 03, 2004 at 12:29:12AM +0000, Dennis Decker Jensen wrote:
> 
> > case 1:
> > 
> > echo dennis decker jensen | sed -re 's/[a-z]+/\U&/'
> > DENNIS decker jensen
> > 
> > case 2:
> > 
> > echo dennis decker jensen | sed -re 's/[a-z]+/\u&/'
> > ennis decker jensen
> > 
> > I expected this in case 2:
> > Dennis decker jensen
> > 
> > It eats the character! The same thing happens when using \l (\L).
> 
> I can reproduce this bug on Warty, but not on Hoary.  It seems to have been
> fixed.

Hmm, actually my test was flawed, and "case 2" is reproducible on both.

These two cases seem to demonstrate the problem more clearly:

mizar:[~] echo abc abc abc | sed -e 's/a/\u&/g'
bc bc bc
mizar:[~] echo abc abc abc | sed -e 's/a/\ua/g'
bc bc bc

This seems to happen even with the C locale.

-- 
 - mdz




More information about the ubuntu-users mailing list