[Gllug] Finding files with names that differ by case
Anthony Newman
anthony.newman at ossified.net
Thu Sep 20 13:43:13 UTC 2007
Jon Dye wrote:
> Hi,
>
> 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'
2 /USR/INCLUDE/LINUX/NETFILTER_IPV4/IPT_CONNMARK.H
2 /USR/INCLUDE/LINUX/NETFILTER_IPV4/IPT_DSCP.H
2 /USR/INCLUDE/LINUX/NETFILTER_IPV4/IPT_ECN.H
2 /USR/INCLUDE/LINUX/NETFILTER_IPV4/IPT_MARK.H
2 /USR/INCLUDE/LINUX/NETFILTER_IPV4/IPT_TCPMSS.H
2 /USR/INCLUDE/LINUX/NETFILTER_IPV4/IPT_TOS.H
2 /USR/INCLUDE/LINUX/NETFILTER_IPV4/IPT_TTL.H
2 /USR/INCLUDE/LINUX/NETFILTER_IPV6/IP6T_HL.H
2 /USR/INCLUDE/LINUX/NETFILTER_IPV6/IP6T_MARK.H
2 /USR/INCLUDE/LINUX/NETFILTER/XT_CONNMARK.H
2 /USR/INCLUDE/LINUX/NETFILTER/XT_MARK.H
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list