find

Simple unix command, what is the {} and \; for

With this set of commands, what are the {} and \; characters for? find . -name '*.clj' -exec grep -r resources {} \; ...

mdfind equivalent on linux?

ok, so I finally got a Macbook pro and to tell the truth I am astonished by both the architecture, speed, and os on this laptop. Mac OS X is a beautiful system, from the mach kernel up to finder and spotlight and speaking of spotlight, it truly blew me away when I just needed to execute this command to get all unix executables and ONLY ...

Semantic difference between "Find" and "Search" ?

When building an application, is there any meaningful difference between the idea of "Find" vs "Search" ? Do you think of them more or less as synonymous? I'm asking in terms of labeling for application UI as well as API design. ...

JPA EntityManager find with case sensitive key

I'm trying to use the JPA EntityManager find() method. My primary key is a string which corresponds to a user's name. I am using JPA / Hibernate / MYSQL. My problem is a search for user 'David' matches user 'david' due, I assume, to the case insensitive string matching in the underlying MYSQL. This causes me a whole heap of problems!...

Visual Studio find doesn't find all possibilities

Recently, I've begun to notice that Visual Studio 2008 isn't finding all of the instances of a text I search for when I'm searching Entire Solution. It will start to search through the files to find a term, but then at some point, it stops searching other files, and starts alternating between only two files. This is very aggravating, b...

Getting objects updated in last 10 seconds from ActiveRecord's find

Hi, I'd like to get the objects that are updated in the last 10 seconds from the ActiveRecord's find. I tried doing this @chats = Chat.find(:all, :conditions => ["updated_at > ?", 10.seconds.ago] ) as well as @chats = Chat.find(:all, :conditions => ["updated_at > ?", Time.now-10.seconds] ) and even @chats = Chat.find(:all, :con...

Is there a regular expression to find two different words in a sentence?

Is there a regular expression to find two different words in a sentence? Extra credit for an expression that works in MS Visual Studio 2008 :) For example: reg_ex_match(A, B, "A sentence with A and B") = true reg_ex_match(C, D, "A sentence with A and B") = false See also this related question ...

Filter out find results where I may not read file / see directory contents

Example: find / * Gives me all files and directories, but I want only those files I may read and those directories I may see the contents of. Otherwise I get problems as when I try to find file information for all files: for i in ls $( find / * ); do file $i; done Which results in: find: /lost+found: Permission denied find: /proc/...

Best way to do a find/replace in several files?

Hey dudes, what's the best way to do this? i'm no command line warrior, but i was thinking there's possibly a way using grep and cat. i just want to replace a string that occurs in a folder and sub-folders. what's the best way to do this? i'm running ubuntu if that matters. -d ...

Checking value exist in a std::map - C++

I know find method finds the supplied key in std::map and return an interator to the element. Is there anyway to find the value and get an iterator to the element? What I need to do is to check specified value exist in std::map. I have done this by looping all items in the map and comparing. But I wanted to know is there any better appro...

map complex find operation

I want to do the following: Define a map between a string and any kind of object (may be a list, integer - anything). The keys to the map can be as follow (the values are, again, not important): "AAA/123" ==> 1 "AAA/" ==> 2 "BBB/" ==> 3 "CCC/*" ==> 4 "CCC/123" ==> 5 Now, the trick is I want to find the right values given the following st...

Any program or trick to find the definition of a variable?

Hello, Many times when I am watching others code I just want to find where and how a variable is defined. Normally what I do now is look for the type of the variable until I find the definition, that is very time consuming. And I guess that there are some tools that can help me in this rutinary situation. Any suggestion in some tools or...

IE Find fails with hidden textarea

Open the following HTML snippet in IE (6 or 7) as HTML document. Ctrl+F and look for "test". IE never finds if the search term "test" which happens to be in the hidden textarea. <html> <body> <table> <tr> <td style="display:none;"> <textarea >test</textarea> -- first hidden 'test' is here ...

In java under Windows, how do I find a redirected Desktop folder?

I know using .NET languages such as C#, one can do something like Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) to find the redirected location of the Desktop. However, under Java, I cannot think of a good way to do this. What is the most appropriate way to find a redirected user Desktop directory from Java, ...

How to print the line that matches my text using find in linux?

Hello I am using this command to find text within files in linux find ./ -type f -exec grep -l "Text To Find" {} \; The command works fine, but I would like to print automatically the line that contains the text or if it is possible the firs two lines above the text and the two lines behind the text. Also another suggestions to find ...

Tricks to Google for desired page quickly

I like to use Google to quickly locate API documentation. To get better results, I type some keywords that give desired results as top lines. For example: JavaScript: MDC Array slice MDC String indexOf Ruby ruby doc Dir glob rubyonrails ActionMailer What are your favourite tricks to pick the desired pages quickly? P.S. ...

With Unix find(1), how do I find files in one tree newer than counterparts in another tree?

Let's say I have two directory structures: /var/www/site1.prod /var/www/site1.test I want to use find(1) to see the files that are newer in /var/www/site1.test than their counterparts in /var/www/site1.prod. Can I do this with find(1), and if so, how? ...

Vectors, structs and std::find

Again me with vectors. I hope I'm not too annoying. I have a struct like this : struct monster { DWORD id; int x; int y; int distance; int HP; }; So I created a vector : std::vector<monster> monsters; But now I don't know how to search through the vector. I want to find an ID of the monster inside the vector. ...

Find all duplicates and missing values in a sorted array

Suppose you have a sorted range (x to y) of values in an array. x = 3; y = 11; array == 3, 4, 5, 6, 7, 8, 9, 10, 11 But it is possible that some values are duplicated and some are missing, so you might have: array == 4, 5, 5, 5, 7, 8, 9, 10, 10 What's the best way in your language to find all duplicates and missing values so you g...

How can I record changes made during in-place editing in Perl?

I've scripted up a simple ksh that calls a Perl program to find and replace in files. The passed-in arg is the home directory: perl -pi -e 's/find/replace/g' $1/*.html It works great. However, I'd like to output all the changes to a log file. I've tried piping and redirecting and haven't been able to get it work. Any ideas? Thank...