FAQ Database Discussion Community


how to ignore directory in find by full path

linux,find,gnu-findutils
I want to write a function that will find files in current directory I'm currently in. The thing is that if I'm in /home, I want to find files in sys, dev and var directories (which is in my home folder). But If I'm in root folder I wish them...

bash: Expand list of arguments and pass it to find - escaping/white spaces hell

linux,bash,shell,find,escaping
I want to check a folder for files and delete some of them. One condition is to keep all files of a certain type (e.g. .txt) and also keep all files with the names of the first search but with different extensions ([names of first search].). All other files in...

How can i find closest value given map? [closed]

c++,dictionary,find,value
I have a map like: typedef map<double, double> Test; Test test; I want to find a nearest value of given data, for example: Given the value 5.12, what is the closest value in the map? How can I do that?...

Can anyone improve on the below Fuzzyfind function for VBA?

algorithm,vba,function,find,fuzzy-search
This function lets you find similar strings from a range without having to do an exact search. The formula looks like this: =FuzzyFind(A1,B$1:B$20) assuming the string you are performing a search for is in A1 and your reference or options table is B1:B20 The code is here: Function FuzzyFind(lookup_value As...

How can i change filename in console automatically

ubuntu,replace,find
I have a great number of files whose name is "img800400_497708.307247.png" and i would like to change in console all the points by an underscore. How can i do that?

dokku - where is my application's directory

directory,find,docker,dokku
I am trying to access logs of my Node.js application which is written in file mylogfile.log inside application's directory. Using find / -type f -name mylogfile.log i was able to see this output: /var/lib/docker/aufs/diff/0303e86afdc58e13b5afcc07ea3694e0e9e6d5e5cf8530a0854a76fbe2baf574/app/mylogfile.log /var/lib/docker/aufs/diff/a9a0dab44456acd8b43915ed686c282b778ab99df31f62076082e121274ef6e2/app/mylogfile.log /var/lib/docker/aufs/mnt/0303e86afdc58e13b5afcc07ea3694e0e9e6d5e5cf8530a0854a76fbe2baf574/app/mylogfile.log What are those...

find a div by classname and replace it with a div based on onclick - jquery

javascript,jquery,find,toggle,show-hide
There are 8 divs and an empty div. Also there are 8 checkboxes. Initially 4 divs are displayed and the remaining are display:none and 4 checkboxes are checked and remaining are uncheked The Fiddle link is here This is my code <div class="container"> <div class="empty" style="display:none;"></div> <div class="content div_box_1"> <div...

Search for text1 AND text2 in a line of file.txt

batch-file,cmd,find,findstr
I am trying to return results only for lines that contain matching text via cmd. In this case the line must match in both "Name" and "Surname". Read though http://ss64.com/nt/findstr.html, and tried the first example findstr "James Henry" sam.txt >sam2.txt Unfortunately, this also returns all lines that contain just James...

How to improve performance of changing files and folders permissions?

linux,ubuntu,permissions,find,chmod
I setting up my work project permissions in series to: 755 for all directories 644 for all files I do it by running next commands: $ find /path/to/project -type d -exec chmod 0755 {}; $ find /path/to/project -type f -exec chmod 0644 {}; It works fine, but a bit slowly,...

Custom .find() tied to a Sequelize Model

model,find,sequelize.js
Couldn't find what I wanted in the documentation, so I'm just going to leave this here and hope for some help! I have a specific query that I need to run on my user Model with a lot of includes and those includes all have where statements inside of them......

Find index of string + integer in python

python,integer,find
I have a string "Something M6" and I want to find if "M6" is present in the string or not. The 6 in "M6" can be any integer. Is there any way to find it without using a regular expression or a for loop

Only remove white space which precedes a specific character. with libre office regex engine

regex,replace,sed,find,libreoffice
I'm attempting to perform this in Libre Office's regex engine and sed in ubuntu terminal. 1.Example strings: -Polizeiwache (f)police station -Freibad (n)open-air swimming pool 2.Desired outputs: -Polizeiwache (f)policestation -Freibad (n)open-airswimmingpool I've been trying to select the character ) and replace every succeeding space with nothing. Any help is appreciated....

Linux/shell - Remove all (sub)subfolders from a directory except one

linux,delete,find,folder,rm
I've inherited a structure like the below, a result of years of spaghetti code... gallery ├── 1 │   ├── deleteme1 │   ├── deleteme2 │   ├── deleteme3 │   └── full │   ├── file1 │   ├── file2 │   └── file3 ├── 2 │   ├── deleteme1 │   ├── deleteme2 │   ├── deleteme3 │  ...

How can i find smallest value in a tree?

python,tree,find,traversal
def Find_Min(tree,smallest): if tree == []: return smallest elif tree != []: if smallest > tree[0]: smallest = tree[0] Find_Min(tree[1],smallest) Find_Min(tree[2],smallest) def main(): array = [1, [0, [222,[],[]], [4,[],[]] ], [-6, [99,[],[]], []]] print("Smallest element in list: " + str(Find_Min(array,array[0]))) if __name__ == '__main__': main() return None. Where am I...

Find recently modified files on windows console

cmd,find,windows-console
I need to check in cmd if there are specific files recently modified (90 min). On linux, my command works well: find /home/my_folder -type f -mmin -90 -name *.txt On MS-DOS, I cannot find a way to filter regarding modification time: forfiles /P directory /S ...

Find all files contained into directory named

linux,bash,shell,command-line,find
I would like to recursively find all files contained into a directory that has name “name1” or name “name2” for instance: structure/of/dir/name1/file1.a structure/of/dir/name1/file2.b structure/of/dir/name1/file3.c structure/of/dir/name1/subfolder/file1s.a structure/of/dir/name1/subfolder/file2s.b structure/of/dir/name2/file1.a structure/of/dir/name2/file2.b structure/of/dir/name2/file3.c structure/of/dir/name2/subfolder/file1s.a structure/of/dir/name2/subfolder/file2s.b structure/of/dir/name3/name1.a ←this should not...

Delete directories with specific files in Bash Script

bash,find,xargs,rm
I would like to delete specific files if existed but also the directories that contain these files. I do know the files I would like to wipe but not the directories. So far, as I'm new in bash scripting, I think of this : find ./ -type f -name '*.r*'...

Recursively recode all project files excluding some directories and preserving permissions

linux,shell,find,recode
How to recursively recode all project files excluding some directories and preserving permissions?

Cakephp Find all WHERE in two categories

php,cakephp,find,cakephp-2.3
I have trouble finding items that belong to two or more categories in cakephp 2. In my Controller I have the following: $kategories = array(1,2); $options['conditions'] = array('Categorie.id' => $kategories); $items = $this->Item->find('all',$options); The query above shows all Items that have either associated category-id 1 or 2. How can I...

Mongoose find() not show my output in console.log

node.js,express,mongoose,find
I am working on a project with node, express, mongo and I am trying to query all my topics out of the db. I believe my code is correct but when I run the app in de browser my console.log does not show my output. This is my code of...

using the find function and the exec flag

bash,find,exec
This is noob question: I'm trying to run the following script that I found online: find <file name> -type f -exec cat {} for some reason I'm getting an find: missing argument to '-exec' error. What am I doing wrong?...

Shell programming - reading and outputting the contents of found file

bash,shell,find,echo,username
I'm attempting to create a shell script that will find a file, read that file, output the contents of that file and sorting the contents by username. The text file that the script is finding will simply contain a list of usernames and processes. For examples the usernames will look...

MongoDB: $all with empty array…

mongodb,find
I'm running a query on a collection with documents like these. {"name": "Daniel", "tags": ["person", "owner", "father"]}, {"name": "Jane", "tags": ["person", "owner", "mother"]}, {"name": "Jimmy", "tags": ["person", "owner", "son"]} Now, if I want to find all documents matching the tags person AND owner I would do something like this var...

Pretty recursive directory and file print

linux,find,unzip
I am building a JAVA app that saves the output of bash commands into a list. @root ~/a $ zipinfo -1 data.zip a.txt b.txt test/ test/c.txt root@ ~/a $ find . . ./test ./test/c.txt ./b.txt ./data.zip ./a.txt The idea is to compare files and directories from the zip to what...

How to grep for filenames found by find in other files?

grep,find
How can I grep for the result of find within another pattern? That's how I get all filenames with a certain pattern (in my case ending with "ext1") find . -name *ext1 -printf "%f\n" And then I want to grep for these filenames with another pattern (in my case ending...

Find commands don't work in script only

bash,find
I have a script that searches specific locations for .txt files and outputs the results to stdout, and to a file using the tee command. At least it's supposed to. I'm having some strange issues with it however. Here's the code: echo -e "${HIGHLIGHT}Sensitive files:${OFF}" echo "## Sensitive files:" >>...

Permission denied in find: why do we need 2>&1?

bash,error-handling,find,io-redirection
I was recently searching for a way to filter out 'Permission denied' errors while searching for a file using the find command, and I found this link: How can I exclude all "permission denied" messages from "find"? Here's an the answer that worked for me from the link: find ....

How to find the timestamp of the latest modified file in a directory (recursively)?

linux,bash,find,filesystems
I'm working on a process that needs to be restarted upon any change to any file in a specified directory, recursively. I want to avoid using anything heavy, like inotify. I don't need to know which files were updated, but rather only whether or not files were updated at all....

List files that only have number in names

bash,file,numbers,find,ls
I have a directory with these files: 1.html 22.html 333.html zxc.html I want to get a list of the html files that only have digits in their name: 1.html 22.html 333.html I thought this would work find . -regex '^[0-9]+\.html' or ls -al | grep -E '^[0-9]+\.html$' But I get...

How to find a specific number from a user inputed list in python [duplicate]

python,list,for-loop,find
This question already has an answer here: Python count elements in list 7 answers I want the program to find the number of times a particular number occurs within a list. What am I doing wrong here? def list1(): numInput = input("Enter numbers separated by commas: ") numList =...

Using basename to name output file in java

java,find,xslt-1.0,filenames,zsh
I have a recursive structure of directories containing some foo files that I want to convert to bar files using a XSLT 1.0 stylesheet. I have: dir |-- subdir | |-- file1.foo | |-- file2.foo | |-- file3.foo And I want to obtain: dir |-- subdir | |-- file1.foo |...

How do I locate and perform a command on all executable files matching a given pattern?

security,find,file-permissions
How I identify all files on my Unix (OS X) system matching a particular pattern that have their executable bit set, so that I can perform a command on them? For example, I'd like to locate all .doc files created before a given date that have any executable bit set,...

SML - Find element in a list and substitute it

string,list,find,sml,substitute
I'm trying to build a function which takes as input two list of type (string*string) list and returns one list of the same type. The first list is like a "lookup" list in which the second element is the element to search and the first element is the element to...

Ignore directory path in find (in shell) [duplicate]

shell,find,ignore
This question already has an answer here: exclude directory from find . command 17 answers I'm trying to find files in some dir and ignore some path. cd /some/dir && find . -type f ! -path ./media doesn't work. Where is a mistake? Any directory with the same name...

Regular Expression not matching in notepad++

regex,replace,find,notepad++
I am trying to match this regular expression in notepad++, but I am getting an error saying that it is invalid. My Regex: {{#lsth:JointEntero_May_2015\|2015_May_([0-9]+)}} What I am trying to match: {{#lsth:JointEntero_May_2015|2015_May_8}} Why is it failing?...

Finding a number that is sum of two other numbers in a sorted array

arrays,sorting,find,sum
As it said in the topic, I have to check if there is a number that is the sum of two other numbers in a sorted array. In first part of the question (for a unsorted array) I wrote a solution, just doing 3 loops and checking all the combinations....

Perl - Regex to find and replace ampersands that aren't part of a character entity

regex,perl,replace,find
So I am currently using the code: $mystring =~ s/&/&#38;/g; To find and replace all ampersands (&) in my string variable, and replace them with the XML entity reference for ampersands (&#38;). The problem is, I want to only replace ampersands that are NOT already part of an XML entity...

Loop PHP check until text within webpage has been found

php,file,loops,while-loop,find
On pressing the submit button, I want the PHP code to check to see if a string exists within a webpage on another website. $random = rand(100,1000); strpos(file_get_contents('website.com/url.php?username='.$username), $random); So, until the code has managed to find the value of $random, it won't continue with the rest of the script....

Selenium can't seem to find and click a button on website? - Python

python,selenium,selenium-webdriver,find,element
I am trying to make software that automaticly collects data for me from fiverr.com website. It searches for specific term, and then it should press LOAD MORE button at the end of page, and keep clicking it until it loads all the 'gigs'. Anyway, I have good idea of how...

Finding elements who meet a specific condition

matlab,find
I've a matrix A and I'd like to find elements of first row which have 1 in the second row. i.e. for following matrix A= 2 5 6 1 1 0 0 1 I'd like to have output as hits = [2 1] without using loops. and then finds the...

how to get regex 'or groups' like (foo|bar) working with find -regex? (OS X)

regex,osx,find,group
Suppose I want to find all .jpg and .png images, using a regex, I'm trying this: find . -regex ".*\.(jpg|png)" But it doesn't work (no results, even though there are jpg and png files present). Now, if instead of the (jpg|png) part I just use jpg or png, it works...

Where is the cupsctl terminal executable on MacOSX?

osx,shell,unix,find,cups
I've looked everywhere, and can't seem to find cupsctl anywhere. I assume it's a lot like echo or sh, it's just an executable with a PATH variable sat somewhere on the system. In order for me to call an NSTask from an Obj-C app I'm working on, I need to...

MongoDB: find documents with a given array of subdocuments

arrays,mongodb,find,aggregate,subdocument
I want to find documents which contain given subdocuments, let's say I have the following documents in my commits collection: // Document 1 { "commit": 1, "authors" : [ {"name" : "Joe", "lastname" : "Doe"}, {"name" : "Joe", "lastname" : "Doe"} ] } // Document 2 { "commit": 2, "authors"...

How to search value in two Array in MongoDB

arrays,mongodb,find
I have some data in MongoDB, the data structure is like {"a":{"b":[1,2,3,4,5],"c":[a,b,c,d,e]}} 1--->a 2--->b 3--->c 4--->d 5--->e I want get the right part value by the left like search b by 2 How can I do this Thank you very much...

Creating a Loop from a Recorded Macro

excel,excel-vba,find
I have 2 sets of data that have to be matched based on one identifier that they both have in common (Range 1 is on Sheet1 and it runs from Column A:F, Range2 is on Sheet3 and runs from Column A:M). The matching values for both ranges will occur in...

Using vector std::find with a user-created object - third argument

c++,stl,iterator,find
I am trying to make use of std::find to search a vector and return an iterator of the required object is found. The problem I am having is that I am not sure what to put as the third argument. Below is the relevant line of code as well as...

Find replace all in DOM error

javascript,replace,find
I am trying to find all occurrences of ?sid=XXXXXXXXXXand replace them with blank. I have this same code working elsewhere on my page finding and replacing a phone number (for example). I am executing the following command: document.body.innerHTML = document.body.innerHTML.replace(/?sid=XXXXXXXXXX/g, ''); A sample of the HTML it is supposed to...

Bash: numbered files in Find

linux,bash,find
I was writing a bash script that finds and deletes the .blend1 and .blend2 files that blender creates as you edit and save .blend files. It contains lines in pairs like this: find Documents -name "*.blend1" -exec rm -rf {} \; find Documents -name "*.blend2" -exec rm -rf {} \;...

How to find a value entered in a textbox in a
  • list in javascript
  • javascript,jquery,find
    I have a group of values in a <ul> list and I want to search the value entered in a textbox to be highlighted in the li list. How can I do this?

    jQuery: set / reset form fields with certain class (improve code)

    javascript,jquery,html,find,show-hide
    I am new to jQuery and hope someone here can help me with this. I have a large HTML form with a hidden div ('#requestDetails'). Within this div there are checkboxes, radio buttons and selects with a certain class on a specific value ('.hiddenDefault') which is used to only apply...

    How to find a List using Find method of entity framework passing Array as parameter? c#,entity-framework,find,entity-framework-6
    I would like to know how to find a List<Object> using Find method of Entity Framework passing Array(object[]) as parameter? I want to find all data by Primary Key. I first fill a list with all PK that I will use as reference: List<int> lCodigoServicos = new List<int>(); foreach (ServicosSelecionadosModelView...

    errorlevel of find /v is always 0

    windows,batch-file,cmd,find,errorlevel
    When calling a find /V /I only with /V(!) the ERRORLEVEL is always 0 it appears to me. (Using Win7 x64) If, for example, I run the following batch file @echo off SETLOCAL enabledelayedexpansion find /V /I "camstart" testtest.txt echo Errorlevel is !ERRORLEVEL! on this testtest.txt file intrinsicParamStatus(2338763) calibrationFormatID(260) calibrationFormatID(260)...

    Mongo return first set of results found from 3 finds()

    mongodb,find
    Is there a way for me to search a list of options until one of them comes back with results? Or is there a better way in general to find records with the following three queries: { "geoTargets.countries.name": {$in: ["US"]}, "geoTargets.countries.regions.name": {$in: ["NY", "NJ"]}, "geoTargets.countries.regions.cities.name": {$in: ["City 1", "City 2",...

    how to repeat last word of a line using notepad++

    regex,replace,find,notepad++
    I have multiple lines in a file. I want to repeat the last word on a line with additional suffix space or tab and prefixed with ,. For example, the sample content of the file would look like: Deepak Kumar Deepak The powerhouse Deepak mcapatna The output file what I...

    Search deep nested JSON

    javascript,json,search,find,underscore.js
    I am working on a solution where I need to search for an element in a deeply nested JSON by its id. I have been advised to use underscore.js which I am pretty new to. After reading the documentation http://underscorejs.org/#find , I tried to implement the solution using find, filter...

    find and replace strings in files in a particular directory

    regex,sed,find,pattern-matching
    I have a pattern that I need to replace in my .hpp, .h, .cpp files in multiple directories. I have read Find and replace a particular term in multiple files question for guidance. I am also using this tutorial but I am not able achieve what I intend to do....

    Change file names by Perl [closed]

    regex,linux,perl,find
    How to change file names from notation like this: SomeCodeFile.extension to C/C++ notation: some_code_file.extension. I'd like to use Perl + Find + Regex to print those names.

    find row indices of different values in matrix

    matlab,find,row,cell,indices
    Having matrix A (n*2) as the source and B as a vector containing a subset of elements A, I'd like to find the row index of items. A=[1 2;1 3; 4 5]; B=[1 5]; F=arrayfun(@(x)(find(B(x)==A)),1:numel(B),'UniformOutput',false) gives the following outputs in a cell according to this help page [2x1 double] [6]...

    how set unix alias with current directory works on every path

    unix,path,find,cygwin,alias
    i have this alias that works on "/" directory but stops working when path changes alias exesh='chmod +x $(find . -maxdepth 1 -name '*.sh')' I am a newbie with Unix so any help is welcome *I'm using cygwin, if can be this the issue * Bash, on this problem, says...

    jQuery find closest product image

    jquery,find,closest
    I am trying to find product's profile picture with jQuery . My store is located at: http://45.55.232.92/index.php?route=product/product&product_id=51 And my product detail located between div's which class is product-info. And example code is: var img = $(this).closest('li').find('img:first'); How can I find my product's profile image?...

    Mongoose find and findOne middleware not working

    node.js,mongoose,find,middleware
    If have the following schema and middleware hooks, but the find and findOne hooks are never being called. The save and update hooks work as expected. According to the Mongoose Middleware documentation, this should be available. // define the schema for our recs model var recSchema = mongoose.Schema({ dis: String,...

    find and remove all closed files that are not modified in some-time

    linux,delete,find,filesystems
    I'm building a script in linux that will remove files from the disc that aren't in used corrently by the OS. I want to use find command so i can execute rm for all the files that i find that are not open. I tried so far this command without...

    (SOLVED) jQuery show content in :after when certain DIV is found in document

    jquery,find
    I have user reviews tab on our shop and put image to this in .tab:afterjust to make it more visible. But I want to show this content only when there already is any user review. Why my code doesn't work? <script> $(document).ready(function() { if($('.review').length) { $(".tab:after").css("display", "block"); } else {...

    Object Variable or With Block Variable Not set in loop using find function

    vba,excel-vba,loops,object,find
    Sub Main() Dim FName As Variant, R As Long, DirLoc As String, i As Integer R = 1 i = 1 DirLoc = ThisWorkbook.Path & "\" 'location of files FName = Dir(DirLoc & "*.csv") Do While FName <> "" ImportCsvFile DirLoc & FName, ActiveSheet.Cells(R, 1) R = ActiveSheet.UsedRange.Rows.Count + 1...

    Find and Replace brackets () with new Line in Visual Studio

    regex,visual-studio,visual-studio-2013,replace,find
    I have to add some javascript code in VS 2013. Before (Now) Layout.init(); After (What I want) Layout.init(); Side.init(); If there were no () I could do it with \n but VS do not find them. How can I change them like latter? edit: I want to change all my...

    how to find a specific string in a vector and use it in an if statement [duplicate]

    c++,vector,find
    This question already has an answer here: How to find an item in a std::vector? 14 answers This is what my vector starts as: vector<string> inventory; inventory.push_back("sword"); inventory.push_back("armor"); the player of this game will be able to choose two of three items with this code block: while(paid < 2)...

    Calling find more than once on the same folder tree

    linux,bash,shell,unix,find
    I'm running a find command multiple times on the same group of files. The results of my find commands are usually disjoint sets, AKA I'm running find -mmin +35; find -mmin -25, and doing different things to the results. It seems sort of silly to search through the entire file...

    Python parser on xml not able to return branches

    python,xml,parsing,find,branch
    I am currently attempting to parse a downloaded xml file and write to a csv file however I'm a little inexperienced with xml formatting. Regardless I am able to return the elements from the first branch Filing but I am unable to return anything from the following branches such as...

    How is `each` different from `for-loop` when returning a value?

    javascript,functional-programming,find,each
    I have my each function which I created to emulate Underscore.js's _each() for my Javascript study. var each = function(list, iteratee) { if (Array.isArray(list)) { // list is array for (var i = 0; i < list.length; i++) { iteratee(list[i], i, list); } } else if (list.constructor === Object) {...

    Create a list of numbered linux folders in specific ranges

    linux,bash,shell,find
    In a specific folder I have got about 10,000 subfolders. All these folders have got numeric names only and I need to create a list of all existing foldernames from 0 to 60,000. The only way I know is using the * wildcard with the find command. Using < or...

    Regular expression for deleting everything between two HTML tags

    regex,replace,find,notepad++,edit
    I am trying to use Notepad++ to bulk-delete blocks of comments placed between <HTML> and <HEAD> tags in a large number of files. Which regular expression phrase should I use?...

    UnderscoreJS : filter part of string

    string,filter,find,underscore.js
    I would like to filter data but without giving the whole string. For example, I have an Array with value:'myString', I would like to filter that even if i just pass 'my' or 'String'. Any idea ?...

    'find' with wildcard

    find,osx-yosemite
    I am on OS/X yosemite. I have performed similar searches like the following many times: uncertain why it would not work here. The search is: $find . -name \*assembly\*.jar It returns nothing. Now, what should it return? Well let us remove the extension and re-run the search: $find . -name...

    Find and Replace not working Java Swing

    java,replace,find
    I'm making a simple text editor in Java and for some reason my find and replace actions won't work, i made two separate frames, one for the find action, and the other to open up another frame with 2 jtextfields for find and replace. i have in my actionperformed if(source...

    Array seach in array with Array.Find() method in vb.net

    arrays,vb.net,find
    i have an array Dim A1 as array = { 4, 2, 7 } i have an second array Dim A2 as array = {{1, 21, 13}, {4 , 2, 7}, {5, 4, 5}} how can i find A1 in A2 with Array.Find() method? Thanks...

    jquery find the value in an array and delete it [duplicate]

    jquery,arrays,find,push
    This question already has an answer here: How to remove specifc value from array using jQuery 13 answers I have an array [0,1,2,3,4,5] what I want to do is check for a value say 3 and then remove it [0,1,2,4,5] I was trying to check for it using jQuery.inArray(questions[count],...

    Bash variable substitution on find's output through exec

    bash,find,exec,substitution,built-in
    Is there any way to apply bash variable substitution on find's output? I know I've seen some one do it on stack overflow but I can't seem to find that particular post anymore. As an example, let's say I want to rename files *.png to *_copy.png. I know I can...

    VBA Range.Find function on rounded negative numbers

    excel-vba,find,rounding
    I'm having an issue with a VBA macro I wrote, with the part that is intended to find a lowest value in range. The line looks like this: Min = Application.WorksheetFunction.Min(a0eqB) Set MinCell = a0eqB.Find(Min, LookIn:=xlValues) And it returns Object variable or With block variable not set error. Now, I...

    Rails Mongoid show all documents using “where”

    ruby-on-rails,find,mongoid
    I try to pass value as parameter, to array: Controller: @users = User.all.page(params[:page]).per(params[:per_page]).order(sort_by => sort_order).where(type: {'$all': ["#{params[:type]}"] }) Now, is it possible to find all document from collection using: .where(type: {'$all': ['something_to_find_all_from type:'] }) ?...

    'find' (command) finds nothing with -wholename

    linux,bash,directory,find
    Why does this command work: /home/user1/tmp $ find ./../.. -wholename '.*/tmp/file.c' -exec echo '{}' \; ./../../user2/tmp/file.c /home/user1/tmp $ And this command does not work? (finds nothing) /home/user1/tmp $ find /home -wholename '.*/tmp/file.c' -exec echo '{}' \; /home/user1/tmp $ ...

    Need to sum a column if 2 or 3 columns contain a specific text

    excel,find,sumifs
    I've the following data set and want to add the values that reflect "ABC" in any cell. Column1 Column 2 Column 3 Column 4 Column 5 ABC is good CNN $150 ABC NBA Better life N-H $40 LIT MNM Nice Job ABC is good $35 MN ABC Poor H-I $200...

    Splitting a line into token with find()

    c++,split,find
    I want to split this line : cmd1; cmd2; cmd3 Into 3 strings I will stock into a list. like cmd1 cmd2 cmd3 So I made this code : main.cpp #include <string> #include <iostream> #include <list> int main() { std::string line("cmd1; cmd2; cmd3"); std::list<std::string> l; size_t pos = 0; size_t...

    Regex/Algorithm to find 'n' repeated lines in a file

    regex,algorithm,count,find,duplicates
    I am looking for an advanced version of this. Basically, if I have a file with text: abc ghi fed jkl abc ghi fed I want the output to be:(for n=3) Duplicated Lines abc ghi fed Times = 2 ...

    Regular expression find command cygwin?

    regex,linux,unix,find,cygwin
    I've never been able to get regular expressions in Cygwin to work for me. Here's some background info: -find (GNU findutils) 4.5.12 I have the following files in my directory: -rw-rwxr--+ 1 None 0 Jun 4 19:16 eiooo.txt -rw-rwxr--+ 1 None 0 Jun 4 19:20 g.py -rwxrwx---+ 1 None 96...

    Specify extended regex for cross platform find command

    regex,find
    In Ubuntu, to be able to use extended regex during a find you can specify the -regextype flag but in OSX it requires the -E flag. Is there a portable way to do the following? find app -type f -regextype posix-extended -regex '.+\.(handlebars|partial)'...

    How to verify more than 1 file exist with a given file extension in perl

    perl,find,file-exists
    My requirement is to know whether are at least 2 .wav files in a directory. Currently I'm using grep(/\.wav$/,readdir($dir)) to get the number of .wav files exist and then check whether its greater than 1. But I really don't want to count all the files if there were 1000s of...

    How do I create search like excel in DataGridView?

    c#,excel,datagridview,find,search-engine
    I used this code to search in DataGridView to find and select a row (no filter)! But, when DataGridView has repetitive values in rows it won't get the next row! How do I go to the next row with every click to Btn_find (Find similar to Excel)? private void button1_Click(object...

    Find a .csv file in directory with header newColor value = 'blue' and return other columns(oldColor, length) [closed]

    python,bash,csv,find
    I have lots of csv files. I want to find those files who have their newColor column set to blue and for those files, I want to print columns name, oldColor and length on console. How can I do that? Sample data in files file1.csv name type oldColor length newColor...

    Substract last cell in row from first cell with number

    excel,find,row,difference,subtract
    I have the following Excel sheet In column J i need the final difference between the first cell in the row and the last cell (with a number). Numbers can appear from column C until column I. Numbers do not always start in column C and do not always end...

    std::find in a vector of glm::vec3 is not working (OpenGLTriangle Normals with a crease angle)

    c++,opengl,vector,find,duplicates
    i am new in OpenGL and C++ and have a problem my code: vector<glm::vec3> vTempNormals; glm::vec3 normal{...}; ... if (angle < glm::radians(creaseAngle)) { if (angle != 0.0f) { if (std::find(vTempNormals.begin(), vTempNormals.end(), normal) == vTempNormals.end()) vTempNormals.push_back(normal); } } I'm trying to avoid duplicates of glm::vec3 normal in my vector-container by checking...

    Match string within quotation marks to string out of quotation marks in Word

    vba,replace,find,wildcard,defined
    I have a document that has an index of defined terms in it. Each defined term can be found within quotation marks. Wherever the term is actually used in the document, it is not within quotation marks. Where each term is used in the document, I would like to change...

    Why would my find method return undefined?

    javascript,functional-programming,find,each
    I'm recreating a number of Underscore.js methods to study JavaScript and programming in general. Below is my attempts to recreate Underscore's _.find() method. var find = function(list, predicate) { // Functional style _.each(list, function(elem){ if (predicate(elem)) { return elem; } }); }; var find = function(list, predicate) { // Explicit...

    Find and replace in an AS3 String

    string,actionscript-3,replace,find
    I want to find the "(*" string in another string and then replace it with the < and / one but the method replace() can not do it. Sorry, but I can not write the string in the description together :D Here is my code: //Call the method like.. trace(searchandreplace("(*Foo)"));...

    Regular expression to replace text between XML tags using Notepad++

    html,regex,replace,find,notepad++
    Regular expression to replace text between XML tags using Notepad++ I need to replace all URL tag if containe /mailto/ with "" in Notpad++ I need to find and replace text between html tags. Example: xml: <urlset> <url> <loc>http://www.file3.ir/last-books/183-Education/The-Praeger-Handbook-of-Learning-and-the-Brain-%5B2-volumes%5D</loc> <lastmod>2015-05-02T21:15:06+00:00</lastmod> <priority>0.00</priority> <changefreq>monthly</changefreq> </url> <url>...

    How can heredocs be used with xargs?

    find,posix,xargs,heredoc,ed
    Background I'm looking to strip any # TODO comments from some python source code files output by git archive before sending it off. I'm looking to do so from a script that will be run from a variety of *nix OSes, so it should be as POSIX-compliant as possible. I'm...

    Find all instances of string in anotherstring

    c++,string,loops,find
    Below i have a peice of code that compares two strings. if (long.find(short) != string::npos) { cout << "FOUND"; } This only tells me if it finds the short string in the long string. But how can i go about finding all the instances and tell the user where those...

    Find & delete folder (ubuntu server)

    bash,ubuntu,find,backup
    I have a backup system in my ubuntu server that every day makes a database backup and save it in a folder named like the day: $(date +%d%m%y) But on the script, when I try to find and delete the folders from the last week, the command don't find any...

    unity | Find child gameObject with specified parent

    unity3d,find,parent-child,gameobject
    I have to find child gameObject with specified parent. Uhm. Let me explain more detail. I'm creating the prefab which have one child gameObject named 'state' and the name of parent gameObject is changed when i play the game. I mean the name of child gameObject is always same but...

    Find entry in .netrc file via bash and delete it if exists

    linux,osx,bash,replace,find
    In bash, how do I search for the following string in a file ~/.netrc and delete that line plus the next two lines if found: machine api.mydomain.com Example is: machine api.mydomain.com user foo password bar It should delete all three lines, but I can't match user and password since those...

    Find a Value and insert a row in VBA

    excel,vba,excel-vba,find
    Sub o() Dim x As Integer Dim y As Integer For y = 2 To 2 For x = 1 To 600 If Cells(x, y).Value = "CD Sector Average" Then Cells(x, y).EntireRow.Select Selection.Insert Shift:=xlDown Cells(x + 2, y).Select End If Next x Next y For y = 2 To 2...