find

Moving multiple files having spaces in name (Linux)

谁都会走 提交于 2019-12-20 04:06:30
问题 I have a directory which contains multiple files with spaces in their names. I want to find a pattern in the name and those file will be moved to some other directory. Now the problem is that when the particular pattern is found in a single file name, that file is moving to the destination path but when there are multiple files this method fails. Below is the code that I'm using : for file in `find . -maxdepth 1 -name "*$pattern*xlsx" -type f` do mv "$file" $destination/ done 回答1: No need to

Saving substrings using Regular Expressions

我们两清 提交于 2019-12-20 03:36:13
问题 I'm new to regular expressions in Java (or any language, for that matter) and I'm wanting to do a find using them. The tricky part that I don't understand how to do is replace something inside the string that matches. For example, if the line I'm looking for is Person item6 [can {item thing [wrap]}] I'm able to write a regex that finds that line, but finding what the word "thing" is (as it may differ among different lines) is my problem. I may want to either replace that word with something

How to find missing values in a sequence with PHP?

空扰寡人 提交于 2019-12-20 03:30:09
问题 Suppose you have an array "value => timestamp". The values are increasing with the time but they can be reset at any moment. For example : $array = array( 1 => 6000, 2 => 7000, 3 => 8000, 7 => 9000, 8 => 10000, 9 => 11000, 55 => 1000, 56 => 2000, 57 => 3000, 59 => 4000, 60 => 5000, ); I would like to retrieve all the missing values from this array. This example would return : array(4,5,6,58) I don't want all the values between 9 and 55 because 9 is newer than the other higher values. In real

Loop through formula Excel VBA

白昼怎懂夜的黑 提交于 2019-12-20 03:09:52
问题 I need to go through the existing formula and delete entire row if there is no minus sign in it. Is there a way to go through the formula char by char or there is another way to identify if there is a “-” in the formula? Sub clearvalidation() Dim ws As Worksheet For Each ws In ActiveWorkbook.Sheets Set vali = ws.Cells.Find("Validation", LookIn:=xlValues, LookAt:=xlPart) If Not vali Is Nothing Then fr = vali.Row + 2 lr = ws.Cells(fr + 1, 6).End(xlDown).Row For exclrow = fr To lr For Each char

find command with 'regex' match not working

隐身守侯 提交于 2019-12-20 02:59:06
问题 Am trying to do a simple file-name match with this below regex which I tested to be working from this page for a sample file-name ABC_YYYYMMDDHHMMSS.sha1 ABC_20[0-9]{2}(0[1-9]|1[0-2])([0-2][0-9]|3[0-1])([0-2][0-3])([0-5][0-9])([0-5][0-9])\.sha1 When I couple this in the -regex flag of find like find . -type f -regex "ABC_20[0-9]{2}(0[1-9]|1[0-2])([0-2][0-9]|3[0-1])([0-2][0-3])([0-5][0-9])([0-5][0-9])\.sha1" the command is not identifying the file present in the path (e.g ABC_20161231225950

JavaScript window.find doesn't work absolutely

北战南征 提交于 2019-12-20 02:52:10
问题 When I try to pass text which spreads throughout a few block elements the window.find method dosent work: HTML : <!DOCTYPE html> <html> <head> <meta charset=utf-8 /> </head> <body> <p>search me</p><b> I could be the answer</b> </body> </html> JavaScript : window.find("meI could be"); Or: str = "me"; str+= "\n"; str+="I could be t"; window.find(str); This happens when the <p> element is present between the search term. How can I fix that? 回答1: As option: function containsStr(str) { return

Find record, that has ALL associated records

一笑奈何 提交于 2019-12-20 02:49:07
问题 Say, we have a "Person" and "Favorite" models. "Favorite" is what this person likes: "music", "video", "sport", "internet", "traveling" etc. "Person" HABTM "Favorites", and "Favorite" HABTM "Persons" I need to find a Person, that has ALL listed "Favorites. For example, find a person, that likes "music", "traveling" and "sport". How it can be done, using ActiveRecord.find method ? 回答1: @people = Person.find(:all, :joins => :favourites, :select => "person.*, count(favourites) favourite_count",

Find and replace text with jquery, only text no child elements

*爱你&永不变心* 提交于 2019-12-20 01:33:09
问题 I want to find and replace text with jquery. I want to change "SKU:" to "art nu." <span itemprop="productID" class="sku_wrapper"> SKU: <span class="sku"> 5-144 </span>. </span> I tried: $(".product_meta>.sku_wrapper:contains('SKU:')" ).text('art nu.'); but this delete the child span sku. Hope someone has a solution... 回答1: since jquery 1.8 you can do it also like this: $(".sku_wrapper").html(function(i,t){ return t.replace('SKU:','art nu.') }); 回答2: Did you simply try $(".sku_wrapper" ).each

“find: missing argument to `-exec'” running in a Java process builder

爱⌒轻易说出口 提交于 2019-12-20 01:07:50
问题 I am trying to run the find command inside Jenkins (https://jenkins-ci.org) script console, which allows running groovy scripts from a web interface. My code is: ProcessBuilder pb = new ProcessBuilder(); pb.directory(new File("/var/lib/jenkins/jobs/myJob"); pb.redirectOutput(ProcessBuilder.Redirect.INHERIT); pb.redirectError(ProcessBuilder.Redirect.INHERIT); command = 'find . -name build.xml -exec echo \"{}\" \\;' println(command) pb.command(command.split(" ")); pb.start().waitFor(); The web

JQuery: How to find out how many children an element has?

此生再无相见时 提交于 2019-12-19 17:44:52
问题 How can I use jQuery to find out how many children an element has? Say I have the following structure: <div id="container"> <div id="column1"> <div id="asset1"></div> <div id="asset2"></div> </div> <div id="column2"> <div id="asset1"></div> <div id="asset2"></div> </div> </div> I want to find out how many children the div element: container, has. In this case it would return 2... 回答1: Use children and length: $("#container").children().length 回答2: Use the direct children selector (>) and the