Re: m[A-Z].* --> [a-z].*
Tim Chase <sed <at> thechases.com>
2005-09-01 20:03:19 GMT
> sed 's/\<m\([A-Z]\)/\l\1/'
[cut]
> msgRead += read(mReadFd, offset, sizeof(mBuffer) - msgRead);
[cut]
> sgRead += read(mReadFd, offset, sizeof(mBuffer) - msgRead);
Are you sure you used the same Sed expression? I copied your
code example into a file and ran it through
sed 's/\<m\([A-Z]\)/\l\1/g'
getting back just what I'd expect:
tim <at> scoria:~/temp$ diff x <(sed 's/\<m\([A-Z]\)/\l\1/g' x)
9c9
< msgRead += read(mReadFd, offset, sizeof(mBuffer) - msgRead);
---
> msgRead += read(readFd, offset, sizeof(buffer) - msgRead);
(adjusted the spacing to make it fit on one line)
It looks like (from your results) that you may have omitted the
\(...\) portion or its contents.
Additionally, you might want to make *all* the changes on each
line, which is indicated by the "g" flag at the end.
There might be something peculiar with your version of sed too.
I tried the above with GNU Sed (4.1.2) from bash, running on
Debian. Which version, and on which platform (and if germane,
(Continue reading)