LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 12-02-2008, 05:07 AM   #1
matt_heys
LQ Newbie
 
Registered: Jan 2008
Posts: 20

Rep: Reputation: 0
Question Locate AND search


Does anyone know of a more elegant way of doing an AND based search using Locate?

I want to use it to find my MP3's from a PHP script so I can access my music off a NAS device anywhere in the world.

currently I've come up with

locate -i akon |grep -i locked |grep -i up
this will find :-

Akon - Locked Up.mp3
03_akon_-_locked_up.mp3
locked_up-Akon.mp3

I tried to do a regular expression but it would only work in the order the words were in, but my RegEx is really poor.

I'm doing this on Debian Etch on an NSLU2 if it makes a difference.
 
Old 12-02-2008, 09:50 PM   #2
jstephens84
Senior Member
 
Registered: Sep 2004
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,043

Rep: Reputation: 83
I would really go back to using the regexp. It will be a lot better and cleaner once you understand it. Could you post what you were trying to use for the regexp.
 
Old 12-02-2008, 10:08 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 11,796

Rep: Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923Reputation: 923
regex doesn't play well with logical AND like that.
With (more) reduced data at each step, what's the issue with your current solution ?. Piping like that is normal in *nix. If you are really concerned about re-running the data, try and ensure the most restrictive parameter is passed to locate.
 
  


Reply

Tags
commandline, locate


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
possible search crash.../home/httpd/linuxquestions/questions/search.php aus9 LQ Suggestions & Feedback 3 09-06-2008 07:27 PM
Idea to bounce off of you all. Instant search server? Similar to locate? tbeehler Linux - Software 2 05-05-2008 10:08 AM
Can you make search ...search a string in a link....a url...a web address aus9 LQ Suggestions & Feedback 4 04-16-2008 09:37 AM
LXer: Use Web search engines to locate XML LXer Syndicated Linux News 0 05-07-2007 06:32 PM
cpan> locate -u Unknown shell command 'locate -u'. Type ? for help. sharad2005 Linux From Scratch 1 08-04-2006 12:40 AM


All times are GMT -5. The time now is 11:09 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration