find

How to convert a find command to instead use grep to filter and then `exec` commands on output?

我是研究僧i 提交于 2019-12-23 04:36:52
问题 I have a scenario where I need to execute a series of commands on each file that's found. This normally would work great, except I have over 100 files and folders to exclude from find 's results for execution. This becomes unwieldy and non-executable from the shell directly. It seems like it would be optimal to use an "exclusion file" similar to how tar or grep allows for such files. Since find does not accept a file for exclusion, but grep does, I want to know: how can the following be

Nagios plugin to check files are created within x minutes

一世执手 提交于 2019-12-23 04:24:09
问题 I'm trying to convert a bash script to nagios plugin The script will run a find command to see if files are created within x minutes: #!/bin/bash # #Check NVR newfiles=$(find /srv/unifi-video/videos/* -name '*.ts' -mmin -10 | wc -l) if [[ $newfiles -eq 0 ]] ; then echo "!!!WARNING!!! The NVR has System stopped recording." fi I tried to convert that script to a Nagios plugin here: #!/bin/bash # #Check NVR #http://www.netchester.com #Check if NVR System is recording correctly newfiles=$(find

Find the index of numerically closest value [duplicate]

寵の児 提交于 2019-12-23 04:14:11
问题 This question already has answers here : Mapping 2 vectors - help to vectorize (6 answers) Closed 6 years ago . Say I have 2 matrices in matlab : A = [1 4 6 9 11 13 15 18 21] B = [2 10 19] Is there a function I can use so that, for every element in B, I am able to find the index of the closest value to that element in A. For instance, in the above example: 2,10 and 19 are numerically closest to 1,9 and 18 in A, and the indices of 1, 9 and 18 are 1,4 and 8, so the function should return [1 4 8

Use PHP to Replace HTML with HTML

笑着哭i 提交于 2019-12-23 03:57:30
问题 Is there a way to use PHP to find some HTML within a page, and replace that HTML with other HTML? I'd like for this function to be in a separate functions.php file, and look at each page on page-load for the HTML that needs replacing (unless this isn't as efficient as some other method). Thanks! 回答1: //function to add to your function definitions. function print_processed_html($string) { $search = Array("--", "*", "\*", "^", "\^"); $replace = Array("<\hr>", "<b>", "<\b>", "<sup>", "<\sup>");

Excel VBA code to select cells that contain a certain text string in one workbook, and then copy and paste these cells into a new workbook

社会主义新天地 提交于 2019-12-23 03:20:52
问题 I have a large set of data contained within single column in an Excel spreadsheet. I have been trying to work out a way of automating a method to select certain data from this column in one workbook, and paste it into a column in a new workbook. For example, I have a list of names in the column. I wanted to select any cells that contain the text "First name:", and then copy and paste these cells into a column in a different workbook. I can do this manually using the 'Find All' tool within

Find Date variable within a row and return Column VBA

走远了吗. 提交于 2019-12-23 02:45:24
问题 I am looking to find a variable within a row and return the column reference. The code I have written so far is; Dim VarianceDate As String VarianceDate = Sheets("Summary").Range("C12").Value Rows("6").Find(What:=VarianceDate, After:=ActiveCell, LookIn:=xlFormulas _ , LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Activate TargetCol = ActiveCell.Column In this example the Variance date is 01/06/2015, however when I stepinto the code in

Find all lines that contains given string

你说的曾经没有我的故事 提交于 2019-12-23 02:33:28
问题 System.IO.StreamReader file = new System.IO.StreamReader(@"data.txt"); List<String> Spec= new List<String>(); while (file.EndOfStream != true) { string s = file.ReadLine(); Match m = Regex.Match(s, "Spec\\s"); if (m.Success) { int a = Convert.ToInt16(s.Length); a = a - 5; string part = s.Substring(5, a); Spec.Add(part); } } I'm trying to get all lines that contains the word "Spec" and then a space character but I get an error when I run this program. The details of the exception are as

Meteor: how do I return data from fields in a specific object?

流过昼夜 提交于 2019-12-23 02:30:57
问题 This should be a fairly simple one. myobject has various properties, _id, name, createdBy, date etc In my find query I want to only return specific fields from within myObject. So for example, what would I need to do to modify the find query below so that only name was returned? myCollection.find({createdBy: someId}, {fields: {myObject: 1}}).fetch(); Currently this will return everything in myObject which it should do, I just want one field within myObject returned. 回答1: Here is a way to do

How to Find Replace Multiple strings in multiple text files using Powershell

佐手、 提交于 2019-12-23 02:28:07
问题 I am new to scripting, and Powershell. I have been doing some study lately and trying to build a script to find/replace text in a bunch of text files (Each text file having code, not more than 4000 lines). However, I would like to keep the FindString and ReplaceString as variables, for there are multiple values, which can in turn be read from a separate csv file. I have come up with this code, which is functional, but I would like to know if this is the optimal solution for the aforementioned

Find control in class — cannot find control

旧时模样 提交于 2019-12-22 14:52:03
问题 I have an aspx page with an ajax tab container. In a class I want to find the tab container to pass some values. I define myPage : Page myPage = (Page)HttpContext.Current.Handler; When looking in more details on this myPage by clicking add watch it is listing the tab container I am looking for. However when I define my tab container AjaxControlToolkit.TabContainer Workflow_TabContainer = null; Workflow_TabContainer = (AjaxControlToolkit.TabContainer)myPage.FindControl("Workflow_TabContainer")