Menu
  • HOME
  • TAGS

Regular expression find command cygwin?

regex,linux,unix,find,cygwin

-name and -iname use globs, not regular expressions. And -regex and -iregex will be false if the regular expression is invalid. Also note that -regex and -iregex attempt to match the entire path, not just the filename.

how set unix alias with current directory works on every path

unix,path,find,cygwin,alias

with suggestion on using find -exec i finally my problem solved. The solution is: alias exesh='find . -name "*.sh" -exec /bin/chmod +x {} \;'

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

linux,osx,bash,replace,find

Try: sed -i '' '/^machine api.mydomain.com$/{N;N;d;}' ~/.netrc When this finds the line machine api.mydomain.com, it reads in two more lines and then deletes them all. Other lines pass through unchanged. For GNU sed, the argument to -i is optional. For OSX (BSD) sed, the argument is required but is allowed...

Splitting a line into token with find()

c++,split,find

Second argument of substr is not an index of lat character to copy. It is length of target substring. l.push_back(line.substr(ex_pos, pos-ex_pos)); http://www.cplusplus.com/reference/string/string/substr/...

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

arrays,vb.net,find

Here is the closet thing I could think of that does what you're wanting with the Find() method. If you change your 2D array to a List(Of Integer()) you can do the following: Imports System Imports System.Collections.Generic Imports System.Linq Public Module Module1 Public Sub Main() Dim A1() as Integer =...

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

c++,dictionary,find,value

Use std::map::upper_bound to find the value that is larger than x. Then decrement the iterator to find the smaller value and check which of these two is closer to x. Of course you have to check that you are only accessing valid iterators. In general you have to be careful...

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

mongodb,find

You could make use of the $or operator to club these conditions together and execute them. The Boolean $or operator of the aggregation framework does an short circuit evaluation, i.e, if the preceding condition is satisfied, the rest of the conditions are not executed against the document. var condA =...

Bash: numbered files in Find

linux,bash,find

find Documents -name '*.blend[12]' -delete (-delete is a GNU find extension.) Other ways: find Documents '(' -name '*.blend1' -o -name '*.blend2' ')' -delete find Documents -name '*.blend*' -delete ...

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

excel,find,sumifs

Short Answer Use this array formula: =SUMPRODUCT(IF(IF(LEN(SUBSTITUTE(A:A,"ABC",""))<LEN(A:A),1,0)+IF(LEN(SUBSTITUTE(B:B,"ABC",""))<LEN(B:B),1,0)+IF(LEN(SUBSTITUTE(D:D,"ABC",""))<LEN(D:D),1,0)+IF(LEN(SUBSTITUTE(E:E,"ABC",""))<LEN(E:E),1,0)>0,1,0),C:C) Note: array formulas are entered with ctrl + shift + enter Explaination To test whether or not a cell contains ABC we can use the SUBSTITUTE forumla combined with a LEN to test the difference between the string lengths: LEN(SUBSTITUTE(A:A,"ABC",""))<LEN(A:A) We can then...

Create a list of numbered linux folders in specific ranges

linux,bash,shell,find

You can use awk to filter out your directory list: ls | awk '{if ($1 < 60000) print $1}' Lots of documentation and tutorials exist for awk....

MongoDB: $all with empty array…

mongodb,find

I would suggest you to add the condition in your application layer, and keep your query that gets executed on the server very simple. If the match array has one or more elements, add a query field to your query condition, else execute an empty condition which would return you...

Bash variable substitution on find's output through exec

bash,find,exec,substitution,built-in

It took me a while to get the question. Basically you are asking if something like: echo "${test.png%.png}" could be used to get the word test. The answer is no. The string manipulation operators starting with ${ are a subset of the parameter substitution operators. They work only on variables,...

how to ignore directory in find by full path

linux,find,gnu-findutils

You can use find "$PWD", as in find "$PWD" -path '/dev' -prune -o -print, to search in the current directory by absolute path. Absolute path matches will then succeed.

Substract last cell in row from first cell with number

excel,find,row,difference,subtract

If the numbers are always ordered from smallest to largest, you could simply do this: =MAX(C2:I2)-MIN(C2:I2) If not, things become a bit more difficult. Here's another solution that should work for non-ordered entries: First, add an empty column to the right of Totaal. Second, add seven columns with the following...

Regular expression for deleting everything between two HTML tags

regex,replace,find,notepad++,edit

This one will work even if there are multiple <HTML>/<HEAD> tag pairs in the document: (?i)<\!--(?:(?!<HTML[^>]*>).)*?-->(?=(?:(?!<HTML[^>]*>).)*?<HEAD[^>]*>) Then ReplaceAll with empty string. Settings: ...

Custom .find() tied to a Sequelize Model

model,find,sequelize.js

Give a look at http://sequelize.readthedocs.org/en/latest/docs/models-definition/#expansion-of-models That definitely gives you the chance to create a findByIdWithIncludes method on your Model...

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

javascript,jquery,find,toggle,show-hide

EDIT JSfiddle: click I changed a few thing: I removed your style from your HTML and put it in your CSS; You want to replace the divs so there is no need to hide any; Let me explain the JS: var divs = []; divs.push('<div class="content" id="empty">' + '<div class="box...

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

linux,bash,shell,find,escaping

Use an array, not a string. #!/bin/bash # ^-- must be /bin/bash, not /bin/sh, for this to work excludes=( ) for filename in *.txt; do excludes+=( -not -name "${filename%.txt}" ) done find . -type f -not -name '*.txt' "${excludes[@]}" -exec rm -f '{}' + To understand why this works, see...

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

javascript,jquery,html,find,show-hide

Just improving syntax or style of code you have written: $('[name=requestType]').on('change', function(){ if($(this).hasClass('triggerDiv')){ // show div + set default values $(this).not('select').prop('checked', true); $(this).not('input[type=checkbox], input[type=radio]').prop('selected', true); $('#requestDetails').show(); }else{ // hide div + reset fields $('#requestDetails').find('input[type=checkbox], input[type=radio], input, select').not(':button, :checkbox, :hidden, :radio, :reset, :submit').val('').prop('checked', false);...

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

regex,replace,sed,find,libreoffice

What you're trying to accomplish is unclear. Your text says "replace every", but your example shows replacing only the first space. To replace every: sed 'h;s/[^)]*//;s/ //g;x;s/).*//;G;s/\n//' What this does: h copy the line to sed's hold space s/[^)]*// replace not-a-) repeated with nothing. This deletes the first part of...

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

jquery,find

That's because ".tab:after" selector will return an empty set as jQuery and JavaScript in general can't select/manipulate CSS pseudo elements. You can use a class, toggle it and leave the manipulation to CSS. .tab.block:after { display: block; ... } $(".tab").toggleClass("block", $(".review").length > 0); http://jsfiddle.net/tzefrbvr/...

Find all instances of string in anotherstring

c++,string,loops,find

You can do something like #include <iostream> #include <string> int main() { std::string test = "we are searching for searching here"; std::string str = "searching"; std::string::size_type start = test.find(str); // find the first instance while(start != std::string::npos) // repeat for the rest { std::cout << "Found on pos: " <<...

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

grep,find

You would tell grep that the patterns are in a file with the -f option, and use the "stdin filename" -: find ... | grep -r -f - *ext2 ...

Find and replace in an AS3 String

string,actionscript-3,replace,find

You need to mask "(" and "*" in your pattern: var pattern:RegExp = /\(\*/gi; ...

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

c++,vector,find

if(std::find(inventory.begin(), inventory.end(), std::string("sword")) != inventory.end()) ... do not forget to include <algorithm>...

Search deep nested JSON

javascript,json,search,find,underscore.js

Here's a solution which creates an object where the keys are the uids: var catalogues = test.catalog; var products = _.flatten(_.pluck(catalogues, 'products')); var prices = _.flatten(_.pluck(products, 'prices')); var ids = _.reduce(catalogues.concat(products,prices), function(memo, value){ memo[value.uid] = value; return memo; }, {}); var itemWithUid2 = ids[2] var itemWithUid12 = ids[12] ...

Find & delete folder (ubuntu server)

bash,ubuntu,find,backup

I think you made a small mistake: When you backup on the 7th of may, you create a folder with name 070515. When you search a week later, you look for a folder with name 140515 modified more then 7 days ago. However, this folder has been created only today....

Find all files contained into directory named

linux,bash,shell,command-line,find

If you can use the -regex option, avoiding subfolders with [^/]: ~$ find . -type f -regex ".*name1/[^/]*" -o -regex ".*name2/[^/]*" ./structure/of/dir/name2/file1.a ./structure/of/dir/name2/file3.c ./structure/of/dir/name2/subfolder ./structure/of/dir/name2/file2.b ./structure/of/dir/name1/file1.a ./structure/of/dir/name1/file3.c ./structure/of/dir/name1/file2.b ...

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

jquery,arrays,find,push

You can use .filter() too var array = [0,1,2,3,4,5] var removeItem = 3; array = array.filter(function(value) { return value != removeItem; }); Example...

find row indices of different values in matrix

matlab,find,row,cell,indices

Approach 1 To convert F from its current linear-index form into row indices, use mod: rows = cellfun(@(x) mod(x-1,size(A,1))+1, F, 'UniformOutput', false); You can combine this with your code into a single line. Note also that you can directly use B as an input to arrayfun, and you avoid one...

Python parser on xml not able to return branches

python,xml,parsing,find,branch

What you are doing will only work for immediate children of the root (i.e. "PublicFilings"). However, the tag you are after, "Registrant", is a grandchild, rather than an immediate child. In order to find a tag anywhere in the tree from root, use the following for each of your search...

Find and Replace not working Java Swing

java,replace,find

Your basic problem comes down to the fact that the "selection" highlight won't be painted while the JTextArea doesn't have focus, I know, awesome. However, you could use a Highlighter instead, for example... if (source == find) { try { DefaultHighlighter.DefaultHighlightPainter highlighter = new DefaultHighlighter.DefaultHighlightPainter(UIManager.getColor("TextArea.selectionBackground")); MenuFrame.textarea.getHighlighter().addHighlight(n, n + search.length(), highlighter);...

errorlevel of find /v is always 0

windows,batch-file,cmd,find,errorlevel

find will filter the lines that match a requested condition. As some lines have passed the filter there is no reason to raise the errorlevel to signal that no matching lines have been found so it will be set to 0 errorlevel will be raised (set to 1) only when...

UnderscoreJS : filter part of string

string,filter,find,underscore.js

var myArray = ["myString"]; if(myArray[0].IndexOf("my") != -1 || myArray.IndexOf("String") != -1 ) { ... } I didn't misunderstand the question, did I? Underscore.js wouldn't be required for this, either....

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

security,find,file-permissions

Something like find . -name '*.doc' -perm +0111 -exec chmod a-x ''{}'' ";" It will depend on exactly what you mean by "executable"....

Mongoose find and findOne middleware not working

node.js,mongoose,find,middleware

The issue ended up being the order of the items. Apparently you must define the model after setting up the find hooks. This is not required for the save and update hooks though. // define the schema for our recs model var recSchema = mongoose.Schema({ dis: String, // rec display...

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

batch-file,cmd,find,findstr

If you cannot be sure if the two words stand together or the order might be unsure, you will have to search for both of them separately: findstr /i "\<James\>" sam1.txt | findstr /i "\<Henry\>" sam2.txt \<means "start of a word", \> means "end of a word, so you are...

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

shell,find,ignore

You can use the -regex option: find -type f ! -regex '.*/media/.*' ...

Shell programming - reading and outputting the contents of found file

bash,shell,find,echo,username

Taking what you've written verbatim, assuming the first column in each file is the username: find . -name 'user*' -exec cat '{}' + | sort This concatenates all files found by find into a single stream, and pipes that stream to sort. By default, sort sorts starting at the beginning...

SML - Find element in a list and substitute it

string,list,find,sml,substitute

You're making this way too complicated. This first function looks up a string in the first list: fun lookup ((a,b)::xs) v = if v = b then a else lookup xs v | lookup nil v = v; And this one just runs recursively on both elements in the second...

using the find function and the exec flag

bash,find,exec

The semicolon (quoted or escaped) at the end of line is missing. It should be: find <file name> -type f -exec cat {} \; ...

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

linux,delete,find,filesystems

To get the list of open files you can use lsof command. Get all the list of files from find command in a directory and remove them all. 1). Get the list of open files in a directory. lsof /folderToSearch |awk '{print $NF}'|sed -e '1 d' |sort |uniq >/tmp/lsof 2)....

Specify extended regex for cross platform find command

regex,find

It's not at all ideal, but you could do something like platform=`uname` if [$platform='Darwin']; then find app -type f -E posix-extended -regex '.+\.(handlebars|partial)' else find app -type f -regextype posix-extended -regex '.+\.(handlebars|partial)' fi Note that this will just assume linux if it's not OS X, and I think you need...

Find replace all in DOM error

javascript,replace,find

Don't replace the contents of body element using innerHTML replace, it can have side effects like can remove any registered event handlers etc.... instead target and replace the required var as = document.querySelectorAll('a[href*="?sid=XXXXXXXXXX"]'); for (var i = 0; i < as.length; i++) { var href = as[i].getAttribute('href'); as[i].setAttribute('href', href.replace(/\?sid=XXXXXXXXXX/g, ''));...

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

python,selenium,selenium-webdriver,find,element

First of all, using "layout-oriented" or "design-oriented" classes like btn-standard-lrg and btn-white is a bad practice. Instead, there is a convenient locator "by link text", use it: load_more = driver.find_element_by_link_text("LOAD MORE") Note how readable and simple it is. You may also need to wait until the "Load More" button would...

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

python,list,for-loop,find

numList isn't a list of numbers, it's a list of strings. Try converting to integer before comparing to numFind. if int(num) == numFind: Alternatively, leave numFind as a string: numFind = input("Enter a number to look for: ") ... Although this may introduce some complications, e.g. if the user enters...

jQuery find closest product image

jquery,find,closest

Hope the following solve your problem var img = $(".product-info").find('img:first'); ...

How to find a value entered in a textbox in a
  • list in javascript
  • javascript,jquery,find

    Simplest solution would be: var inputVal = $('input').val(); $('li:contains("'+inputVal+'")').css('background-color','#FF0000'); // or change any other CSS property to highlight ...

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

    regex,algorithm,count,find,duplicates

    One way is splitting your text based on your n then count the number of your elements that all is depending this counting you can use some data structures that use hash-table like dictionary in python that is much efficient for such tasks. The task is that you create a...

    How can i find smallest value in a tree?

    python,tree,find,traversal

    This becomes easier when you separate out the visiting of the tree elements from the minimum finding. It also makes it super easy to create a find_max function should you ever need it :-). Here's some code which should point you in the correct direction ... def visit(tree): for elem...

    How to search value in two Array in MongoDB

    arrays,mongodb,find

    What I would suggest is to modify your structure to be able to make a query you want. My suggested structure is the following: { a: [ {b: 1, c: "a"}, {b: 2, c: "b"}, . . . ] } Then having your b value, you will be able to...

    How do I create search like excel in DataGridView?

    c#,excel,datagridview,find,search-engine

    The idea: Add a private field to the class as an index to remember which row you last found. Reset this index if the search text is changed. (Optional) Iterate through all rows, beginning with the row following the last successful search. If no results were found last search, start...

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

    vba,replace,find,wildcard,defined

    Well, now I know a lot more about Find() in Word than I used to... This works for me in light testing, but will only the handle simple use case of single-word terms, where no term is a substring of another term. Sub Tester() Dim col As New Collection Dim...

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

    python,bash,csv,find

    In Python: import csv import os for root, dirs, files in os.walk(BASEDIR): for filename in files: basename, ext = os.path.splitext(filename) if ext.lower() != ".csv": continue path = os.path.join(root, filename) with open(path) as f: reader = csv.DictReader(f) for row in reader: if row['newColor'] == 'blue': print(row) # maybe? What's your output?...

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

    regex,visual-studio,visual-studio-2013,replace,find

    I'd suggest using Notepad++ > 'Find in Files' option to replace text in bulk. It works for files inside a specific directory or if needed, can traverse all sub-directories and replace them. See the below snapshot for settings needed ...

    List files that only have number in names

    bash,file,numbers,find,ls

    find's -regex matches against the whole path, not just the filename (I myself seem to forget this once for every time I use it). Thus, you can use: find . -regex '.*/[0-9]+\.html' (^ and $ aren't necessary since it always tests against the whole path.) Using find also has advantages...

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

    html,regex,replace,find,notepad++

    You could use the following: Find what: <url>[^<]+?<loc>[^<]+?/mailto/[^<]+?</loc>.+?</url> Search Mode: Regular Expression. Make sure you check . matches newline. This should remove the chunks you are after. You can then do the following: Edit -> Line Operations -> Remove Empty Lines (Containing Blank Characters) to clear your input....

    Find index of string + integer in python

    python,integer,find

    >>> s = 'Something M6' >>> 'M' in s and s[s.rfind('M') + 1].isdigit() True >>> s = 'Something M1' >>> 'M' in s and s[s.rfind('M') + 1].isdigit() True >>> s = 'Something Mx' >>> 'M' in s and s[s.rfind('M') + 1].isdigit() False This works for single digits. It looks for...

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

    regex,perl,replace,find

    &(?!#\d+;) This expression matches any ampersand character that is not followed by hash character with digits. Here is DEMO with more explanation....

    Cakephp Find all WHERE in two categories

    php,cakephp,find,cakephp-2.3

    I looked a little further on this and found the solution: To find all items, that belong to category.id 1 AND 2 (not OR) I just had to add a 'group' parameter to my find like this: $options['group'] = array('Item.id HAVING COUNT(DISTINCT Categorie.id) > 1'); The complete query (working): $kategories...

    Pretty recursive directory and file print

    linux,find,unzip

    One way to remove the . prefix is to use sed. For example: find . ! -name . | sed -e 's|^\./||' The ! -name . removes the . entry from the list. The sed part removes the ./ from the beginning of each line. It should give you pretty...

    Where is the cupsctl terminal executable on MacOSX?

    osx,shell,unix,find,cups

    Use the UNIX find command to search your entire disk starting at the root e.g. find / -name 'cupsctl' Shouldn't actually take all that long assuming an average sized SSD. A couple of seconds on my Mac $ sudo find / -name 'cupsctl' 2> /dev/null /usr/sbin/cupsctl or, as it's OS...

    unity | Find child gameObject with specified parent

    unity3d,find,parent-child,gameobject

    Your question is a little confusing. This is what I understand from what you are asking. How to find a child object of parent object that changes its name during run time. You can do this with the FindChild function but there is another way of doing this. You can...

    Why would my find method return undefined?

    javascript,functional-programming,find,each

    Your return is only returning from the inner (nested) function and your find function is indeed not returning anything, hence the undefined. Try this instead: var find = function(list, predicate) { // Functional style var ret; _.each(list, function(elem){ if (!ret && predicate(elem)) { return ret = elem; } }); return...

    Using basename to name output file in java

    java,find,xslt-1.0,filenames,zsh

    Here's a zsh approach, since it's tagged it as such. for f in **/*.foo(.); print -- java ... -o $f:r.bar $f Remove the print -- when you're satisfied that it looks good. The (.) says files only. The :r says remove the .foo extension. It's helpful to remember the path...

    How to improve performance of changing files and folders permissions?

    linux,ubuntu,permissions,find,chmod

    Reference - [http://superuser.com/questions/91935/how-to-chmod-all-directories-except-files-recursively][1] 1.Most of the time consumed here would go in loading the chmod process for every entry. In order to avoid that use xargs- find /path/to/project -type d -print0 | xargs -0 chmod 755 find /path/to/project -type f -print0 | xargs -0 chmod 644 2.Fortunately, you can opt...

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

    vba,excel-vba,loops,object,find

    If the Cells.Find(What:="Run:" & i,... fails to find a match, the Select part of the statement will then cause the error. You should always store the result of a Find in a range variable and then test that for Nothing. Add this declaration to your code: Dim cellsFound As Range...

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

    linux,bash,find,filesystems

    I actually found a good answer from another closely related question. I've only modified the command a little to adapt it to my needs: find . -type f -printf '%[email protected]\n' | sort -n | tail -1 %[email protected] returns the modification time as a unix timestamp, which is just what I...

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

    perl,find,file-exists

    In scalar context you can iterate over directory items using while(), and immediately break the loop when your condition is met, my $count = 0; while (defined(my $f = readdir $dir)) { if ($f =~ /\.wav$/ and ++$count >= 2) { print "there are at least two wav files\n"; last;...

    How to find a List using Find method of entity framework passing Array as parameter?

    c#,entity-framework,find,entity-framework-6

    You are looking for a Contains query: var lServicosInformados = db.Servicos.Where(x => lCodigoServicos.Contains(x.PKId)); This assumes PKId is the name of your primary id column (you didn't specify the name)....

    Find a Value and insert a row in VBA

    excel,vba,excel-vba,find

    The problem is that you're working in the wrong direction. With your loop, if it finds the value in row 5 (x = 5), for example, it will add a row and shift the row where the value was found down (in this case from 5 to 6). When your...

    Can anyone improve on the below Fuzzyfind function for VBA?

    algorithm,vba,function,find,fuzzy-search

    Try this out, I think it will find the best match Function FuzzyFind2(lookup_value As String, tbl_array As Range) As String Dim i As Integer, str As String, Value As String Dim a As Integer, b As Integer, cell As Variant Dim Found As Boolean b = 0 For Each cell...

    Delete directories with specific files in Bash Script

    bash,find,xargs,rm

    It looks like what you really want is to remove all empty directories, recursively. find . -type d -delete -delete processes the directories in child-first order, so that a/b is deleted before a. If a given directory is not empty, find will just display an error and continue....

    Recursively recode all project files excluding some directories and preserving permissions

    linux,shell,find,recode

    Based on this question, but its solution does not preserve permissions, so I had to modify it. WARNING: since the recursive removal is a part of the solution, use it on your own risk Task: Recursively recode all project files (iso8859-8 -> utf-8) excluding '.git' and '.idea' dirs and preserving...

    Finding elements who meet a specific condition

    matlab,find

    Try this: out = max(A(1,A(2,:) == 1)) Example: >> A A = 2 5 6 1 1 0 0 1 >> out out = 2 Explanation: (if you need) %// create a mask of which column you want mask = A(2,:) == 1 %// by checking all values of 2nd...

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

    regex,replace,find,notepad++

    You can use Find What: (\S+)$ Replace with: $1 $1, Explanation: (\S+) is a capturing group that matches 1 or non-whitespace characters, and $ is the end of the line in Notepad++. Settings: ...

    Calling find more than once on the same folder tree

    linux,bash,shell,unix,find

    Try this: find . -mmin +35 -or -mmin -25 find supports several logical operators (-and, -or, -not). See the OPERATORS section of the man pages for more details. ==================== EDIT: In response to the question about processing the two matches differently, I do not know of a way to do...

    'find' with wildcard

    find,osx-yosemite

    OK discovered the answer. The \* wildcard is not a zero or more characters match. It is apparently a one or more characters match. The following does work $find . -name \*assembl\*.jar ./mllib-tests/target/mllib-perf-tests-assembly.jar ./spark-tests/target/spark-perf-tests-assembly.jar ...

    find and replace strings in files in a particular directory

    regex,sed,find,pattern-matching

    You can use the sed expression: sed 's/throw some::lengthy::exception();/throw CreateException(some::lengthy::exception());/g' And add it into a find command to check .h, .cpp and .hpp files (idea coming from List files with certain extensions with ls and grep): find . -iregex '.*\.\(h\|cpp\|hpp\)' All together: find . -iregex '.*\.\(h\|cpp\|hpp\)' -exec sed -i.bak 's/throw...

    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. If I understood your question correctly, try this: $content = file_get_contents($url); if(str_replace($string, "", $content) != $content) echo "found"; EDIT: do { $content = file_get_contents($url); }...

    dokku - where is my application's directory

    directory,find,docker,dokku

    Please note that the filesystem of a Docker container is not intended to be accessed by users from the host. It's quite complicated actually, since Docker uses a layered copy-on-write filesystem (like AUFS in your case, but that's distribution-specific; most Distros except Ubuntu use Devicemapper instead of AUFS, IIRC). What...

    MongoDB: find documents with a given array of subdocuments

    arrays,mongodb,find,aggregate,subdocument

    What you are asking for here is a little different from a standard query. In fact you are asking for where the "name" and "lastname" is found in that combination in your array two times or more to identify that document. Standard query arguments do not match "how many times"...

    Rails Mongoid show all documents using “where”

    ruby-on-rails,find,mongoid

    Assuming, params[:type] is an array, you can search all users using where, and thereafter sort these results using order. You can find a similar example here. @users = User.where(:type.in => params[:type]).order(sort_by => sort_order).page(params[:page]).per(params[:per_page]) If you're looking for a translated mongoid query you can check out this link Your query might...

    How can i change filename in console automatically

    ubuntu,replace,find

    You can use this script: #!/bin/bash files=*.png for file in $files; do file="${file:0:-4}" [[ "$file" == *"."* ]] && newfile="${file//./_}" && mv "$file.png" "$newfile.png" done save it and then run it. Be sure to be in the directory where the files are in, when running it....

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

    linux,delete,find,folder,rm

    Using PaddyD answer you can first clean unwanted directories and then delete them: find . -type f -not -path "./gallery/*/full/*" -exec rm {} + && find . -type d -empty -delete ...

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

    bash,error-handling,find,io-redirection

    Because the 'permission denied' message is printed in stderr not stdout. 1 is stdout 2 is stderr & specifies that whatever following is a file descriptor not filename 2>&1 redirects stderr to stdout and enables the error message to be piped into the grep command. If excluding permission denied message...

    Regular Expression not matching in notepad++

    regex,replace,find,notepad++

    The regex that works is \{\{\#lsth\:JointEntero_May_2015\|2015_May_([0-9]+)\}\} It is working because the { and } characters must be escaped in order to get matched as literal symbols. {} are usually used as quantifiers where we can set min and/or max characters corresponding to the preceding pattern to match. See the documentation:...

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

    arrays,sorting,find,sum

    Here I am doing it using C: An array A[] of n numbers and another number x, determines whether or not there exist two elements in S whose sum is exactly x. METHOD 1 (Use Sorting) Algorithm: hasArrayTwoCandidates (A[], ar_size, sum) 1) Sort the array in non-decreasing order. 2) Initialize...

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

    javascript,functional-programming,find,each

    This has to do with how return works. Let's look at your code: var find = function(list, predicate) { // you pass list and an anonymous callback to `each` each(list, function (elem) { // if this condition is true if (predicate(elem)) { // return elem return elem; } }); }...

    Find commands don't work in script only

    bash,find

    You need to quote or escape the * in your -name patterns, otherwise the shell tries to expand it and use the expanded form in its place in the command line. find /etc -type f -name '*.txt' -exec ls -lh {} \; 2>/dev/null | tee -a $ofile and the others...

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

    c++,opengl,vector,find,duplicates

    You can't compare floating point values simply using a simple x == y expression as if they were integers. You have to compare them using a "threshold", a "tolerance", e.g. something like: // Assuming x and y are doubles if (fabs(x - y) < threshold) { // x and y...

    Find recently modified files on windows console

    cmd,find,windows-console

    You can use the /C parameter: /C command Indicates the command to execute for each file. Command strings should be wrapped in double quotes. The default command is "cmd /c echo @file". The following variables can be used in the command string: @file - returns the name of the file....