[ILUG] Script junkies

Fergal Daly fergal at esatclear.ie
Tue Apr 10 21:47:40 IST 2001


do a

mkdir -p ABC/abc/ABC

and stick an echo in before the mv command in your script and you'll see 

mv ./ABC/abc/ABC ./abc/abc/abc
mv ./ABC/abc ./abc/abc
mv ./ABC ./abc

when what it really needs to do is

mv ./ABC/abc/ABC ./ABC/abc/abc
mv ./ABC ./abc

Not sure why the grep didn't eliminate the middle line but apart from that,
the problem still remains that it's lowercasing all of components of the
filename in one go,

Fergal


On Tue, Apr 10, 2001 at 09:52:58PM +0100, Padraig Brady wrote:
> What's wrong with this?
> 
> find -depth \( -type f -o -type d \) |
> grep -E "/[^/]*[A-Z]+[^/]*$" |
> sed -e '
> {
>     h
>     y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
>     G
>     s/\(.*\)\n\(.*\)/"\2" "\1"/
> }' |
> xargs -r -n2 mv
> 
> -- 
> Irish Linux Users' Group: ilug at linux.ie
> http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information.
> List maintainer: listmaster at linux.ie

-- 




More information about the ILUG mailing list