[Gllug] Finding files with names that differ by case
Jon Dye
jon at pecorous.co.uk
Thu Sep 20 14:14:03 UTC 2007
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.
>>
>> /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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 257 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.lug.org.uk/pipermail/gllug/attachments/20070920/17acb8a5/attachment.pgp>
-------------- 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