Google Answers Logo
View Question
 
Q: Use Linux locate command to include and exclude certain file names ( No Answer,   1 Comment )
Question  
Subject: Use Linux locate command to include and exclude certain file names
Category: Computers > Operating Systems
Asked by: mikeyb-ga
List Price: $50.00
Posted: 21 Oct 2005 13:32 PDT
Expires: 31 Oct 2005 11:03 PST
Question ID: 583198
Using the linux locate command all files that have _webos_cfg.php in
the file name and do not have the excludethissite.com in the name.


Here's a sample list to work with:

subdomain1.excludethissite.com_webos_cfg.php
sd4.keepthissite.com.com_webos_cfg.php
sd4e.keepthissite.com.com_webos_cfg.php
sd4w.keepthissite.com.com_webos_cfg.php
sd45.keepthissite.com.com_webos_cfg.php
subdomain2.excludethissite.com_webos_cfg.php
subdomain3.excludethissite.com_webos_cfg.php

Clarification of Question by mikeyb-ga on 21 Oct 2005 13:34 PDT
Using the linux locate command, locate all files that have _webos_cfg.php in

The resulting locate output should be :

sd4.keepthissite.com.com_webos_cfg.php
sd4e.keepthissite.com.com_webos_cfg.php
sd4w.keepthissite.com.com_webos_cfg.php
sd45.keepthissite.com.com_webos_cfg.php

Request for Question Clarification by leapinglizard-ga on 21 Oct 2005 14:08 PDT
The locate command does not allow for pattern specifications powerful
enough to carry out this search. If you are open to other means of
accomplishing this from the Linux command line, I can suggest a very
good one.

leapinglizard

Clarification of Question by mikeyb-ga on 24 Oct 2005 04:55 PDT
The reason I am using the locate command is that because the folder
that I need to search has over a million files in it. Sorry I didn't
specify that up front. I am not against the solution being a bash
script as long as it is a fairly readable script.

thanks!

Clarification of Question by mikeyb-ga on 25 Oct 2005 06:12 PDT
locate has a -r parameter to specify a regex statement.
Answer  
There is no answer at this time.

Comments  
Subject: Re: Use Linux locate command to include and exclude certain file names
From: linuxguru-ga on 23 Oct 2005 01:10 PDT
 
It is possible with locate command, I can give you a solution to this.
Alternatively I can give you a solution the uses find instead which
should be just as fast if run in directories of say 1000 files or so.
Regards
Andrew

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy