devries Posted December 20, 2004 Report Share Posted December 20, 2004 Google search is a clever way to search files on your PC. Unfortunately there isn't yet a Linux equivalant so we on Mandrake are a bit behind. However Linux has the 'locate' command that we can use and as long as we give our files meaningfull names that works quite well. All we need now is a nice way to integrate this command in KDE. Fortunately that way has arrived. -1- Install the Kio-locate program (link) -2- Open Konqueror, go to 'setting', go to 'preferences', go to 'web-associations' and make 'locate search for local files' the default search engine. Now type something in the adress bar, give <enter> and there are your files. :) Note: with kcron (another nice KDE program) you can automate the 'updatedb' command (once every night) so you will always find what you need. Quote Link to comment Share on other sites More sharing options...
kde-head Posted December 20, 2004 Report Share Posted December 20, 2004 find, xargs, and grep are your friends find . -print | xargs grep -si 'Monday morning meeting' above searches recursively down through the directory tree below your current position on the command line. Quote Link to comment Share on other sites More sharing options...
devries Posted December 20, 2004 Author Report Share Posted December 20, 2004 How does that integrate in KDE? :P Quote Link to comment Share on other sites More sharing options...
aru Posted December 20, 2004 Report Share Posted December 20, 2004 find . -print | xargs grep -si 'Monday morning meeting'above searches recursively down through the directory tree below your current position on the command line. <{POST_SNAPBACK}> grep -sril 'Monday morning meeting' ./* does exactly the same *but* in a single command ;) and even if you need to use find, xargs is superfluous, ie: find . -iname '*.txt' -exec grep -isl "Monday morning meeting" {} \; Quote Link to comment Share on other sites More sharing options...
kde-head Posted December 20, 2004 Report Share Posted December 20, 2004 find . -print | xargs grep -si 'Monday morning meeting'above searches recursively down through the directory tree below your current position on the command line. <{POST_SNAPBACK}> grep -sril 'Monday morning meeting' ./* does exactly the same *but* in a single command ;) and even if you need to use find, xargs is superfluous, ie: find . -iname '*.txt' -exec grep -isl "Monday morning meeting" {} \; <{POST_SNAPBACK}> but they give differently output formats (extracts are shortened for clarity): find . -print | xargs grep -s 'blog' output : file , result ./class.bloggerclient.php:function blogger_checkFaultString($bloggerResult) { ./class.bloggerclient.php: if ($bloggerResult["faultString"]) { ./class.bloggerclient.php: return $bloggerResult["faultString"]; ./class.bloggerclient.php: else if (strpos($bloggerResult, "java.lang.Exception") !== false) { ./class.bloggerclient.php: return $bloggerResult; grep -sril 'blog' ./* output: file ./bloggerFunctions/blogger.php ./bloggerFunctions/Readme.txt ./bloggerFunctions.zip find . -iname '*.php' -exec grep -isi "blog" {} \; output: file content match // If the user only has one blog, then it returns a string containing the name of the blog // in plain text, with a hidden form input containing the blogid, using the same function getUsersBlogsSelect($name="blog", $selected="", $extra="") $getUsersBlogsArray = $this->getUsersBlogs(); and no it doesnt integrate into kde - although you could pipe the results to dcop and display them in kedit maybe - or just add ">output.txt" to pipe to a file and just open up in your favourite editor. Quote Link to comment Share on other sites More sharing options...
devries Posted December 20, 2004 Author Report Share Posted December 20, 2004 Kio-locate works so much nicer................ Quote Link to comment Share on other sites More sharing options...
aru Posted December 20, 2004 Report Share Posted December 20, 2004 (edited) but they give differently output formats (extracts are shortened for clarity): find . -print | xargs grep -s 'blog' output : file , result ... grep -sril 'blog' ./* output: file ... play with options, I answered from memory...but here you are: grep -sri 'blog' ./* outputs -> file: string ---> man grep or even better egrep ;) find . -iname '*.php' -exec grep -isi "blog" {} \; output: file content match again I was coding from memory, the right command is with two {} {}: find . -iname '*.php' -exec grep -si "blog" {} {} \; sorry for posting w/o testing before and no it doesnt integrate into kde - although you could pipe the results to dcop and display them in kedit maybe - or just add ">output.txt" to pipe to a file and just open up in your favourite editor. <{POST_SNAPBACK}> I have no idea of KDE, and even less about KDE integration, but as an exercise for the boring people, here is a "graphical tool" :lol: #! /bin/bash COMMON="--title $0" SEARCHSTR="$(Xdialog $COMMON --inputbox "String to search in your /home tree" 10 30 2>&1)" # results: find ~/ -exec grep -si "$SEARCHSTR" {} {} \; |\ Xdialog $COMMON --backtitle "may take a while" --logbox - 40 60 Disclaimer: don't correct the script because it hasn't been tested, so probably it wont work ;) Edited December 20, 2004 by aru Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.