[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [4/11] Native MSVC support (file-magic-glob)
From: |
Ralf Menzel |
Subject: |
Re: [4/11] Native MSVC support (file-magic-glob) |
Date: |
Fri, 13 Jul 2007 17:10:32 +0200 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.20 (usg-unix-v) |
Hello,
Paolo Bonzini <address@hidden> writes:
>>> [lL][iI][bB][nN][aA][mM][eE]
>>>
>>> by using this sed expr
>>>
>>> s/[aA]/[aA]/g;s/[bB]/[bB]/g;<22 more>;s/[yY]/[yY]/g;s/[zZ]/[zZ]/g;
>>>
>>> Isn't there a better way? (I can't think of one offhand, given how
>>> this is used to generate a list of "potential_libs", but
>>> still...this can't be very efficient.)
>
> I would do something like this:
>
> s/[A-Za-z]/*|&|ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ*/g
> s/\*|\(.\)|[A-Za-z]*\1[A-Za-z]\{25\}\([A-Za-z]\)[A-Za-z]*\*/[\1\2]/g
Ah, that's a nice solution. I was considering the following:
y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/
s/\([A-Z]\)/[\1\
\1\
]/g
h
s/[^\n]*\n\(.\)\n[^\n]*/\1/g
y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
G
s/\n//
:loop
s/^\(.\)\([^\n]*\)\n.\n/\2\1/
/\n/bloop
which doesn't look too efficient. (Still, its use of pattern space is
it little less extravagant.)
Bye,
Ralf Menzel
[4/11] Native MSVC support (file-magic-glob), Peter Rosin, 2007/07/10
- Re: [4/11] Native MSVC support (file-magic-glob), Charles Wilson, 2007/07/12
- Re: [4/11] Native MSVC support (file-magic-glob), Peter Rosin, 2007/07/12
- Re: [4/11] Native MSVC support (file-magic-glob), Paolo Bonzini, 2007/07/13
- Re: [4/11] Native MSVC support (file-magic-glob),
Ralf Menzel <=
- Re: [4/11] Native MSVC support (file-magic-glob), Paolo Bonzini, 2007/07/13
- Re: [4/11] Native MSVC support (file-magic-glob), Peter Rosin, 2007/07/17
- Re: [4/11] Native MSVC support (file-magic-glob), Eric Blake, 2007/07/17
- Re: [4/11] Native MSVC support (file-magic-glob), Peter Rosin, 2007/07/18
- Re: [4/11] Native MSVC support (file-magic-glob), Charles Wilson, 2007/07/18
[5/11] Native MSVC support (dashL-envvar), Peter Rosin, 2007/07/10
[6/11] Native MSVC support (strip-testsuite), Peter Rosin, 2007/07/10