find

UNIX: find a file in directories above $PWD

I want to find a file with a certain name, but search in direcotories above the current one, instead of below. I'd like something similar to: (except functional) $ cd /some/long/path/to/my/dir/ $ find -maxdepth -1 -name 'foo' /some/long/path/to/foo /some/foo Shell scripts or one-liners preferred. In response to the several questi...

cakephp - find conditions over multiple models

Hi, I am trying to do a find with conditions in two models. Is this possible ? $offices = $this->User->Org->find('first', array( 'conditions' => array( "or" => array( 'Org.website LIKE' => $match, 'Domain.domain' => $match ) ) )); ...

How to get last Git tag matching regex criteria

Hi! I need Git command to get/find last tag starting with 'v' to get last versioning commit (I am using tags with v letter at the beginning to tag next application version (example: v0.9.1beta). Is there any way to do it? ...

Regex sub-expression matching with Find + emacs-regex mode

I'm trying to find some compressed log files, and do some operations on them. I can't use ls because they are thousands of files in the directory and BASH throws a 'argument list too long' error. This has brought me to find, but I'm having trouble with my regex. Here is the whole find command find $i -regex '.*logfile_MP[0-9]-GW0[0-9]...

jQuery find attribute from url hash

Trying to find the attribute value from a url hash. // URL http://url.com/index.html#link // HTML <a href="#link" rel="3">Some link</a> // JS var anchor = window.location.hash.substring(1); // Need help finding attribute value from finding the anchor var attribute = .find('#+anchor').attr('rel'); //this needs to have a value of 3 Al...

Bash copying files with variables

Hi New to bash scripting, I'm writing a script to copy my TV shows accross from a download folder to an archive folder. So far I have this: find `*`show1`*`.avi | cp \"" $0 "\" "/mnt/main/data/tv/Show1" find `*`show2`*`.avi | cp \"" $0 "\" "/mnt/main/data/tv/Show2" I understand this is not the best method, but my skills of bash ...

CakePHP, wrting a better query string.

In Cakephp is there a better way to write this: $unread_orders = $this->Order->find('all', array('conditions' => array('Order.status' => 'unread') )); $read_orders = $this->Order->find('all', array('conditions' => array('Order.status' => 'read') )); $dispatched = $this->Order->find('all', array('conditions' => array('Order.status' => 'd...

Are find results in bash always sorted by filename in ascending order?

I have some code that is dependent on the fact that (until now) I've been getting the results by find in cygwin in ascending order. Is this always the case or have I to be careful about any other "variables", to make sure I will get this result in both Windows / Linux, whatever? Thanks ...

Spaces in path names giving trouble with Find in Bash. Any *simple* work-around?

Is there any way to change the following string so I don't get any problems when there are files/folders with spaces in them? files=`find ~/$folder -name "*@*" -type f` I'd prefer if there was a solution that wouldn't have to involve having to change other parts of my code but this line of code, as everything seems to be working corre...

Getting the id with a rails find with :select

I have this rails find that i need to get the id as well but if i put the id in the :select wont it effect the query and is there another way to get the id @past_requests = Request.find_all_by_artist(name, :conditions => ["showdate < ?", Time.now], :select => "distinct venue, showdate") ...

JQuery: Finding/Filtering on attributes within context

I've been trying a few different ways to filter finding of specific nodes within my html. Here is some example html: <body> <div ui:component="component1"></div> <ul ui:component="component2"></ul> <article ui:component="component3"></article> </body> I've successfully been able to match items by doing a simple filter: /...

std::find vs. deriving template from vector

I use vectors a lot in my programming, and generally to traverse a vector for an existing value I use std::find as in: std::vector<int> foo; std::vector<int>::iterator pos( std::find( foo.begin(), foo.end(), bar ); This is a real bore. So I went to deriving a template from std::vector to provide a find method: template<class T> class...

Find: Paramater format not correct

I keep hearing this is a path issue with cygwin. It is prevent emacs from working within my cygwin. When I execute find on the cli (not bash/cygwin) I get the same error not matter what I type. I've read this is a problem with path creation within cygwin and that it should be prepending itself to the path. As you can see it is doing ...

find without recursion

Hi there, is it possible to use a the find command in some way that it will not recourse into the sub directories? e.g. DirsRoot |-->SubDir1 | |-OtherFile1 |-->SubDir2 | |-OtherFile2 |-File1 |-File2 And the result of something like find DirsRoot --donotrecuourse -type f will be only File1, File2 ? Anyone knows a way...

Scripting Vim with find -exec

Hello, I have a little Vim script which does a multi-line search and replace: vim -c 's/^ *<hi a=\"26\">\nHello/<td height=\"26\">\r<\/table>\r<bla \/>' \ -c 'w!' -c 'q' test.html That works. However, when I put that in a find -exec to do this recursively in the directory: find . -iname 'test.html' -exec \ vim -c 's/^ *<hi a=...

Java: Find and replace words/lines in a file

I have a file (more specifically, a log4j configuration file) and I want to be able to read in the file and pick out certain lines in the code and replace them. For example, within the file there is a string of text that indicates the directory it is stored in, or the level of the logger. I want to be able to replace those string of text...

Finding a class and adding it to another element

I need to find a way to the get the class from a li and then add that class to a div that wraps all my main content. so... <div class="structBody"> <ul id="ContentBreadCrumbsColor"> <li class="teal"></li> </ul> <div class="cntrWrap LI_CLASS_GOES_HERE"> HTML TEXT GOES HERE </div> </div> Can anyone help? I have t...

ASP.net - Regular Expression to add an attribute

I need to find the most optimal solution using Regex to find URL's inside a block of HTML and add a new attribute Name="true" inside the tag. Below is an example of HTML (which can contain embedded JS), I just need to add the new attribute Name="true" to any URL and NOT effect any embedded JS file. Example HTML : <HTML> <a href...

Cakephp - find thread

i have a tweet table that stores tweets and its replies like this tweet(id, parent_id, tweet_message, time) where parent_id is a self id if its a tweet and is of parent id if its a reply. how to do a find to pull out tweets where id = parent_id example: tweet(1, 1, 'My name is Harsha', 'time') parent_id = id since its a tweet and...

Word VBA Range.Find object works incorrectly

I found an interesting thing: In word 2010, select some text, and run the following VBA code: public Sub Test() With Selection.Range.Find MsgBox .Execute(Selection.Range.text) MsgBox .Found End With End Sub Both the two message box say "False", but both should be "True". Why? Thanks a lot for your suggestion...