Questions tagged [find]

This tag has multiple meanings. Please DO NOT use this tag if you're just trying to find something.

find is:

  1. a filesystem search tool on various flavors of *nix,
  2. a filesystem search tool on various flavors of DOS and Windows,
  3. the name of a jQuery method,
  4. the name of a family of methods in ActiveRecord,
  5. a function in the C++ standard library,
  6. a method of strings in Python,
  7. a method of Matcher Class in Java.
  8. a method in many different NoSQL's to find documents in a collection.
11183 questions
3
votes
4 answers

Unix command to insert a comment on the top of all files in a directory

I want to add a comment to all files in a directory in Unix. Please suggest a solution if there is any combination of commands I can use.
Ganpat
  • 67
  • 1
  • 5
3
votes
1 answer

Python ElementTree find() using a wildcard?

I am parsing an XML feed in python to extract certain tags. My XML contains namespaces and this results in each tag containing a namespace followed by tag name. Here is the xml:
mcquaim
  • 159
  • 7
  • 15
3
votes
4 answers

Running command recursively in linux

I'm trying to come up with a command that would run mp3gain FOLDER/SUBFOLDER/*.mp3 in each subfolder, but I'm having trouble understanding why this command doesn't work: find . -type d -exec mp3gain \"{}\"/*.mp3 \; When run, I get error Can't open…
laite
  • 178
  • 1
  • 5
3
votes
2 answers

Find elements in a vector of tr1::shared_ptr

I've wrapped my custom type 'MyType' in a smart pointer: tr1::shared_ptr and made a vector from it: vector> Now I want to std::find an object of type MyType in that vector but can't since the type I'd need would be…
anhoppe
  • 4,287
  • 3
  • 46
  • 58
3
votes
1 answer

Meaning of SearchAllChildren Argument in Controls.Find Method

I'm using the Forms.Controls.Find Method to search the child controls of a parent control. The method has 2 arguments; (Key, SearchAllChildren). I know that the Key argument does a string comparison on the child controls' names and fills the return…
Ian
  • 4,169
  • 3
  • 37
  • 62
3
votes
1 answer

pymongo sort() limit() different?

1. db.bios.find().sort( { name: 1 } ).limit( 5 ) 2. db.bios.find().limit( 5 ).sort( { name: 1 } ) What is the different with them? They are equal? If first one doing: find all documents? it is bad. If db.bios.find().count() is very big(1000000),…
Tsing
  • 33
  • 1
  • 4
3
votes
3 answers

Bash/Shell - paths with spaces messing things up

I have a bash/shell function that is supposed to find files then awk/copy the first file it finds to another directory. Unfortunately if the directory that contains the file has spaces in the name the whole thing fails, since it truncates the path…
3
votes
4 answers

Find all images that have square dimensions (1:1 ratio)

Is it possible to use any *nix programs like 'find' or a scripting language like Python, PHP or Ruby, that can search your HDD and find all images that have the same width and height, aka square dimension?
bafromca
  • 1,926
  • 4
  • 27
  • 42
3
votes
2 answers

How to grep a whole line, pass to sed, and delete the line?

The below command will find all occurances of a string and delete the contents of the files where this string is found. find / -maxdepth 1 -xdev -type f -exec grep -i "stringtofind" -l {} \; -exec sed -i '/./d' {} \; I have tried modifying it to…
user1166981
  • 1,738
  • 8
  • 26
  • 44
3
votes
3 answers

Find files older than FILE without including FILE

I have a plan to use find to give me a list of files that are older than some FILE and then use xargs (or -exec) to move the files to somewhere else. Moving stuff is not a problem; | xargs mv {} ~/trash works fine. Now, if I try to use ! -newer…
dubberx
  • 73
  • 5
3
votes
2 answers

Regex, get what's after the second occurence of a string

I have a string of the following format: TEXT####TEXT####SPECIALTEXT I need to get the SPECIALTEXT, basically what is after the second occurrence of the ####. I can't get it done. Thanks
user1894933
  • 61
  • 1
  • 1
  • 5
3
votes
2 answers

find ignores the first filename that I search for

I search for two files that has changed recently in a folder, but it seems I invoke find incorrectly. In return I get only the results for the second file. find /tmp -name 'twofirmscoop.so' -o -name 'twofirms.so' -exec ls -lt {} + 2>/dev/null
Krzysztof Voss
  • 1,766
  • 1
  • 13
  • 12
3
votes
2 answers

how to optimize jquery code with find()?

i have a form with an id="test". Inside the form i have some select, input and textarea fields. i want to iterate through each of them and check if they are empty and then do something with them. var editTest=…
Patrioticcow
  • 26,422
  • 75
  • 217
  • 337
3
votes
4 answers

find folders with no further subfolders in perl

How do I find, in a given path, all folders with no further subfolders? They may contain files but no further folders. For example, given the following directory…
Balaji S
  • 148
  • 10
3
votes
1 answer

Getting array elements using array index in mongoDB

Consider following collection in mongoDB : {a:[4,2,8,71,21]} {a:[24,2,2,1]} {a:[4,1]} {a:[4,2,8,21]} {a:[2,8,71,21]} {a:[4,2,8]} How can I get following results in a most easily: Getting nth element of…
Handsome Nerd
  • 17,114
  • 22
  • 95
  • 173
1 2 3
99
100