[wellylug] multidot filenames

David Antliff dave.antliff at paradise.net.nz
Wed Jun 1 13:33:21 NZST 2005


On Wed, 1 Jun 2005 andrej at paradise.net.nz wrote:

> Quoting "E.Chalaron" <e.chalaron at xtra.co.nz>:
>
>> Hi all
>>
>> I need to locate filenames with multidots on my system.
>> file.ext1.ext2;
>> Is there a way I can do that ? I tried find without much succes I must
>> say...
>
> find ~  -iregex ".*/[a-zA-Z0-9]*\.[a-zA-Z0-9]*\.[a-zA-Z0-9]**"

Does find not support exclusion classes? e.g [^.]

Perhaps find regexps don't support the regexp I'm about to suggest 
however. That's usually why I just do find | egrep  rather than find 
-name...

All the proposed solutions cover two dots - but what about more 
than two dots (assuming a few things, like dots are never adjacent but 
easy enough to integrate if necessary):

(I've used whitespace to make it easier to read)

[^.]*  \.  [^.]+  \.  ( [^.]+  \. )*  [^.]*

or even tidier:

[^.]*  ( \.  [^.]+ ){2,}  [^.]*


That might work - untested tho.

-- 
David.




More information about the wellylug mailing list