[PLUG] Sed and POSIX character class question

Aaron Burt aaron at bavariati.org
Thu Sep 7 16:33:59 UTC 2006


On Thu, Sep 07, 2006 at 08:34:45AM -0700, David Pool wrote:
> On Thu, 2006-09-07 at 08:15 -0700, Aaron Burt wrote:
> > You might find 'y/[[:lower:]]/[[:upper:]]/' more useful
> > for transliterating lower to upper.
> 
> Thanks Aaron, but, I started with the y option. Does it work for you?
> Here's what I get:
> 
> $ sed 'y/[[:lower:]]/[[:upper:]]/' testing.txt
> THIS IS a upper case uetter.
> 
> Notice that it's substituting a "u" for and "l" here...

After perusing the docs, it looks like SED doesn't support nice regexes
for y//.  The examples use e.g. y/abcdef/ABCDEF/ instead.  The tr shell
command does, though.  

   aaron at abu:~$ tr [[:lower:]] [[:upper:]] < testing.txt
   THIS IS A LOWER CASE LETTER.

Have fun,
  Aaron

-- 
Hypertime: the difference between what you were told about Ubuntu, and
the grim Frank Miller install gorefest you find yourself in now
  -- Dave Green (NTK)



More information about the PLUG mailing list