Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
how to find all files with xx on a filesystem
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
SarahS93
l33t
l33t


Joined: 21 Nov 2013
Posts: 601

PostPosted: Thu Apr 23, 2015 6:50 am    Post subject: how to find all files with xx on a filesystem Reply with quote

How can i find all files on my filesystem they have double xx in the filename?
Not "x", not "xxx" ... how can i only find files they have "xx" in the name?
can anyone help me?
Back to top
View user's profile Send private message
massimo
Veteran
Veteran


Joined: 22 Jun 2003
Posts: 1226

PostPosted: Thu Apr 23, 2015 7:01 am    Post subject: Reply with quote

This should work:
Code:
find / -iname "*[^x]xx[^x]*"

_________________
Hello 911? How are you?
Back to top
View user's profile Send private message
SarahS93
l33t
l33t


Joined: 21 Nov 2013
Posts: 601

PostPosted: Thu Apr 23, 2015 7:26 am    Post subject: Reply with quote

Thank you for the very fast and helpful answer, it works fine!
Back to top
View user's profile Send private message
chithanh
Developer
Developer


Joined: 05 Aug 2006
Posts: 2152
Location: Berlin, Germany

PostPosted: Thu Apr 23, 2015 6:35 pm    Post subject: Reply with quote

This is not fully correct, it won't find files which begin or end with "xx".
Back to top
View user's profile Send private message
SarahS93
l33t
l33t


Joined: 21 Nov 2013
Posts: 601

PostPosted: Fri Apr 24, 2015 5:13 am    Post subject: Reply with quote

You are right, do you know a way for both? xx at the start/end ... and in the middle?
Back to top
View user's profile Send private message
chithanh
Developer
Developer


Joined: 05 Aug 2006
Posts: 2152
Location: Berlin, Germany

PostPosted: Fri Apr 24, 2015 7:50 am    Post subject: Reply with quote

Try this:
Code:
$ find / -iname "*xx*" -a -not -iname "*xxx*"

Not very elegant, but in order to match this with a single pattern, a headache-inducing extended regex is probably needed.

Also note that this will find all kinds of filesystem objects which contain "xx". If that is undesired, add "-type f" after "/"
Back to top
View user's profile Send private message
pilla
Bodhisattva
Bodhisattva


Joined: 07 Aug 2002
Posts: 7718
Location: Underworld

PostPosted: Mon Apr 27, 2015 7:24 pm    Post subject: Reply with quote

Moved from Multimedia to Portage & Programming.
_________________
"I'm just very selective about the reality I choose to accept." -- Calvin
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum