[Gllug] Finding files with names that differ by case

Richard Russell richard.a.russell at gmail.com
Thu Sep 20 14:45:44 UTC 2007


On 20/09/2007, Jon Dye <jon at pecorous.co.uk> wrote:
>
> Anthony Newman wrote:
> > Jon Dye wrote:
> >> I have a directory tree full of files and I'd like to find all the
> files
> >>  whose names only differ in case.  Where files differ by case they
> >> should be in the same directory as each other, e.g.


Ah - I had assumed you wanted to move the files that differed in case into
the same directory (ie I thought "should" indicated your intention rather
than a condition). ie I thought you wanted to find /one/Three and
/one/two/three and put them in the same directory.

:-)

Cheers

Richard

>>
> >> /one/two/three
> >> /one/two/Three
> >> /one/four
> >> /one/Four
> >>
> >> Does anyone have any suggestions as to how I can achieve this?
> >
> > A (likely to be suboptimal) selection of stuff piped together works for
> > me, unless you want the original file names :)
> >
> > spitroast:~ $ find /usr/include -type f | perl -pe 's/(.*)/\U$1/g;' |
> > sort | uniq -c | grep -vE '^[[:space:]]*1'
>
> Marvellous, just the ticket.
>
> I actually did:
> find /usr/include -type f | perl -pe 's/(.*)/\U$1/g;' | sort | uniq -d
>
> which is slightly simpler.
>
> Thanks,
>
> JD
>
> --
> "No information on this!"
>                 - Eddie Izzard
>
>
> --
> Gllug mailing list  -  Gllug at gllug.org.uk
> http://lists.gllug.org.uk/mailman/listinfo/gllug
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.lug.org.uk/pipermail/gllug/attachments/20070920/8feec7aa/attachment.html>
-------------- next part --------------
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug


More information about the GLLUG mailing list