find

Find until that line and replace with another text file windows batch script

一笑奈何 提交于 2019-12-25 01:49:00
问题 I am trying to write a windows batch script that it will search until Example: example1 example2 example3 example4 <jar href="example.jar" main="true"/> So i want to replace first part until ( <jar href ) of the text with another text. I mean the first the first 4 lines will be replaces with another text. Is there any find until and replace method in batch script. 回答1: Your specific scenario is fairly easy to implement in batch. I'm assuming you want to preserve the entire line that contains

Count the number of files in a directory containing two specific string in bash

北城余情 提交于 2019-12-25 01:27:00
问题 I have few files in a directory containing below pattern: Simulator tool completed simulation at 20:07:18 on 09/28/18. The situation of the simulation: STATUS PASSED Now I want to count the number of files which contains both of strings completed simulation & STATUS PASSED anywhere in the file. This command is working to search for one string STATUS PASSED and count file numbers: find /directory_path/*.txt -type f -exec grep -l "STATUS PASSED" {} + | wc -l Sed is also giving 0 as a result:

How to really set a Mongoose default, esp. Boolean?

半城伤御伤魂 提交于 2019-12-25 00:55:03
问题 I have the following schema: const profileSchema = new Schema({ created: { type: Date, default: Date.now }, readonly: { type: Boolean, default: false } }); const Profile = mongoose.model('profile',profileSchema); However I have found that if I query for "date", the date is set on documents, but if I query for "readonly" it is NOT set to false, but will return false on the document. For example: Profile.find({readonly: false}) Will return no documents. However, if I do: Profile.find({}) I will

Use RemoveDuplicates Function And Keep Last Entry

笑着哭i 提交于 2019-12-25 00:33:51
问题 I'm using following Private Sub Worksheet_Change(ByVal Target As Range) (created with support from paul bica): Private Sub Worksheet_Change(ByVal Target As Range) Dim lr As Long, lrT3 As Long, inAV As Boolean lr = Me.Rows.Count lrT3 = Me.Range("A" & lr).End(xlUp).Offset(8).Row inAV = Not Intersect(Target, Me.Range("AV9:AV" & lrT3)) Is Nothing With Target 'Exit Sub if pasting multiples values, Target is not in col AV, or is empty If .Cells.CountLarge > 1 Or Not inAV Then Exit Sub Application

search for text in a cell of dataGridView and highlight the row?

戏子无情 提交于 2019-12-25 00:06:05
问题 Im trying to implement a search function for when the user enters text in a textbox (tbPartNum) and then clicks the "Find" button it then searches the cells in dataGridView1 and once its found it, it highlights the entire row yellow. My code is as follows which obviously doesnt work it throws an error which states "NullReferenceException was unhandled" and underneath it "Object reference not set to an instance of an object." using System; using System.Collections.Generic; using System

controlparameter not found

与世无争的帅哥 提交于 2019-12-24 22:25:14
问题 Error: Could not find control 'mytextfield' in ControlParameter 'mycontrolparam'. <asp:ControlParameter ControlID="mytextfield" Name="mycontrolparam" PropertyName="Text" Type="Int32" /> The error is because "mytextfield" is inside a panel control and I would need FindControl method to find it. But I want to find a quick solution if there is any, how to make mytextfield visible to the control parameter. The same code works on a different page but not on this one. Please keep in mind, I want to

Get vector indices before-and-after (window +/- 1) given indices

淺唱寂寞╮ 提交于 2019-12-24 20:58:51
问题 What's the best Matlab/Octave idiom, given idx a vector of indices, to get the sorted vector of idx +/-1 ? I have an n x 7 data matrix, column 3 is an integer label, and I'm interested in viewing the neighborhood of discontinuities on it. Hence I get the corresponding indices: idx = find(diff(data(:,3)) > 0) 5297 6275 6832 ... 20187 Then if I want to view that neighborhood +/- 1 on my column (e.g. on the (mx2) matrix [idx-1; idx+1] ), I need to form the vector of idx-1, idx+1 either

Cakephp, Retrieve Data for HABTM Models using conditional find

走远了吗. 提交于 2019-12-24 19:16:20
问题 There are 2 Models: Project & Category that are bind with HABTM relationship. I would like to perform a search from projects controller that can do the following: FIND all DISTINCT Project.scedule WHERE Category.slug != 'uncategorised' Apologies for the syntax, I'm no sequel expert. What I have managed to do is to retrieve all projects that do not belong to Category uncategorised into an array however I'm not sure as to how to search again the array result for DISTINCT Project.schedule values

Need counter on find and xarg combo

て烟熏妆下的殇ゞ 提交于 2019-12-24 17:23:25
问题 So I have this code: find cobacoba -type f | xargs -n 5 bash -c 'a=(${0} ${1} ${2} ${3} ${4}); echo "File #: ${a[*]}";' Hoping Result: File #: cobacoba/1.3 cobacoba/1.6 cobacoba/1.q cobacoba/1.5 File #: cobacoba/1.1 cobacoba/1.q2 cobacoba/1.q23 cobacoba/1.4 File #: cobacoba/1.2 I would like to replace # with counter, like 1, 2, 3, so on... 回答1: You can postprocess your output with awk to replace # with the line number: find cobacoba -type f | xargs -n 5 bash -c 'a=(${0} ${1} ${2} ${3} ${4});

Find sub-documents using $in with MongoDB

人走茶凉 提交于 2019-12-24 16:43:09
问题 My task is to find individual authors( comments.user_id ) comment on the article ( _id ) { "_id" : ObjectId("56479d9c8510369a4ecea3a9"), "comments" : [ { "text" : "222", "user_id" : ObjectId("563f2db0e2bf6c431b297d45"), }, { "text" : "333", "user_id" : ObjectId("563f2db0e2bf6c431b297d45"), }, { "text" : "444", "user_id" : ObjectId("563f2db0e2bf6c431b297d45"), }, { "text" : "55555", "user_id" : ObjectId("563e3337e2bf6c431b297d41"), }, { "text" : "00000", "user_id" : ObjectId(