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
1 answer

'find' using regex with variables

Please, help me with the following: Let it be three files: file-aaa.sh file-bbb.sh file-xxx.sh In a bash script I have variables $a=aaa $b=bbb Now, I want to execute something like: find . -name "file-[$a|$b].sh" and expect to get two files in…
Cyril
  • 159
  • 3
  • 16
3
votes
2 answers

find command search pattern

I have below 4 files a_ROLLBACK2to3__test.sql, a_1to2__test.sql, a_2to3__test.sql, a_2to2__test.sql I want to write a find command to return the files a_1to2__test.sql, a_2to3__test.sql and a_2to2__test.sql, the file a_ROLLBACK2to3__test.sql…
Tech Tech
  • 141
  • 2
  • 10
3
votes
1 answer

A MongoDB find() that matches when all $and conditions match the same sub-document?

If I have a set of MongoDB documents like the following, what can I do to get a find() result that only returns the families who have 2 pets who all like liver? Here is what I expected to work: db.delegation.find({pets:2, $and: [{'foods.liver':…
Michael Oryl
  • 20,856
  • 14
  • 77
  • 117
3
votes
1 answer

Find and replace tabs or newline characters in Webstorm

I want to delete all my newline and tab characters in a file using Webstorm. How do I do this?
Max Strater
  • 540
  • 6
  • 17
3
votes
2 answers

MATLAB: finding index of an element in a multidimensional cell array with mixed data types

Like the title says. How do I find the index of a specific element in a matlab cell array? The content of the cell array contains both strings and numbers. Toy example: database = cell(4,2) database(1,1:2) = {'Song', 'Rating'} database(2:4,1) =…
user1661303
  • 539
  • 1
  • 7
  • 20
3
votes
7 answers

How does C# lambda work?

I'm trying to implement method Find that searches the database. I forgot to mention that I'm using Postgresql, so I can't use built in LINQ to SQL. I want it to be like that: var user = User.Find(a => a.LastName == "Brown"); Like it's done in List…
Alex
  • 34,581
  • 26
  • 91
  • 135
3
votes
2 answers

Find the first non-zero column of a matrix (vectorized edition)

I am asking myself what the most "vectorized" solution for finding the values of the first non-zero column of a matrix would look like. If a vectorized solution exists but is very ugly/hackish, I am also asking for the most elegant solution. Let's…
timgeb
  • 76,762
  • 20
  • 123
  • 145
3
votes
2 answers

Find and copy files with relative path

At this Stackoverflow question, it shows how to copy files and it will recurse into subdirectories to copy files. How do I copy files and include the relative path in the copy? For instance, find /path/to/directory/or/just/dot -name…
Engineer2021
  • 3,288
  • 6
  • 29
  • 51
3
votes
3 answers

Doctrine2 find by value in field array

i wonder if there is a way to search for a document field looking like : /** * @var array * * @ORM\Column(name="tags", type="array", nullable=true) */ private $tags; which in database looks like php array interpretation :…
john Smith
  • 17,409
  • 11
  • 76
  • 117
3
votes
1 answer

Changing arguments of {} find exec

Is it possible to change the parameters that are passed to exec in find? For example I need to copy files under a different names: *.txt -> *.new.txt Now I'm doing it for two commands: find /root/test -name "*.txt" -exec cp {} {}.new \; find…
aranel
  • 191
  • 1
  • 1
  • 8
3
votes
2 answers

Never display some records in CakePHP

I would like return some records from my base (eg. users roles) And I use usually function find(), findAll(), etc., and I always must write 'conditions' with like this: not display role admin (name!=admin). My question is, how I can in RoleModel set…
kicaj
  • 2,881
  • 5
  • 42
  • 68
3
votes
3 answers

Capturing output and counting its lines

I'd like to run a find command and then count the lines of the output as well as give out the output of the result. My straight-forward approach was this: output=$(find ...) lines=$(echo "$output" | wc -l) echo "$output" But unfortunately using…
Alfe
  • 56,346
  • 20
  • 107
  • 159
3
votes
1 answer

Way to inspect element and see the PHP page it's on?

Is there a way to inspect an element and see the PHP page (template file) that element is coming from? For example, using Google Chrome's developer tools I can see which .CSS page any element is using. I'd like to do the same to quickly find the…
Michael Romrell
  • 1,026
  • 5
  • 15
  • 31
3
votes
2 answers

crontab not working under arch linux

I tried to set up a schedule to remove the old file and folder after several days. I put the following code in a script file and tried to use crontab to run it every day. The find command worked fine. but the crontab seems not execute the script…
user3547439
  • 35
  • 1
  • 4
3
votes
1 answer

Bash find -exec cp not all files are copyed

I am writing a bash script to find image files and to copy them to a dir. My problem is when I use find it finds all files but when I add -exec cp -n {} $2 \; I know that I have set do not clobber but my test case takes this into account I also…