Questions tagged [findandmodify]

96 questions
0
votes
1 answer

MongoTemplate - Update entry in a nested array

I am trying to update an entry ("propertyOne") in a nested array. The structure looks as follows: Updating the entry "name" in "itemlist" already works: ... fileRepositoryEntity.updateNestedObject("randomitemid", "randompropertyid") …
0
votes
1 answer

get updated value from string pointer C

tearing my hair out over C strings over here. I have a function in a project which returns a char * pointer. I need to change an element of that string before using it. Everything I read says just use a char array with the char[] format, but this is…
0
votes
1 answer

Modify a line within a .txt file in python

So I am trying to modify multiple lines within a text file that meet a criteria. The line will start with "Section", and then I will do some modifying to the line, then I would like to replace the old line with the new line. Currently my code looks…
0
votes
1 answer

Sed not replacing new line pattern in text file

I've got a txt file that I've retrieved from SQL Server Manager and hence the line delimitor is '\r\n'. I would like to change this line delimitor to '\n'. You can see my approach below. The problem is that even afer running the sed, it looks like…
callmeGuy
  • 944
  • 2
  • 11
  • 28
0
votes
2 answers

Excel: is there a way to replace a peculiar part of a cell string?

I have an excel export with a column containing staff previous training sessions in a string. Example: First Name|Last Name|Training title|January 2018 to February 2018 Due to non obligatory form fields from which data was collected, many strings…
0
votes
2 answers

Mongodb findAndUpdate $unset a field with an empty array

This is my example document: { keys: { attr1: ['a', 'b', 'c'], attr2: ['d', 'e'] } } I remove the items in the array like this... { $pullAll: { 'keys.attr2': ['d', 'e'] } } And this leaves me with an empty array for the attr2…
James
  • 3,051
  • 3
  • 29
  • 41
0
votes
0 answers

What http request should I use if I am using the findAndUpdate command in ReactiveMongo

What http request should I use if I am using the findAndUpdate command in ReactiveMongo. My CRUD requests are routed like this: GET /api/1.1/r/:collName controllers.admin.MongoC.index(collName: String) GET …
0
votes
1 answer

how to replace multiple duplicate strings in a file without deleting anything else python 3

Ok so I have this code: for line in fileinput.FileInput("zero.html",inplace=1): if '{problem}' in line: rep = 'a dynamic var' line = line.replace('{problem}', rep) print(line) Now, the problem is that it replaces the…
marsnebulasoup
  • 2,530
  • 2
  • 16
  • 37
0
votes
2 answers

Finding cell and replacing with different value

I am writing a spreadsheet to record queries, once the query has been dealt with want to change the status of the entry to closed. Currently, on Sheet 1 the user can type the code of the query in and select to close it. I then want to search through…
Josie
  • 71
  • 7
0
votes
1 answer

Find and replace line matching a pattern in eclipse

What is the regex pattern to find and replace a line in eclipse ? I am using this pattern \S*\text\S* and it replaces only the word but not the whole line matching the pattern
Aarish Ramesh
  • 6,745
  • 15
  • 60
  • 105
0
votes
1 answer

How can I add array data to the object if field exist/not exist in mongo db

This is my expected result: "ForgotPassword": [ { "UpdatedOn": ISODate("2017-12-06T11:23:23.0Z"), }, { "UpdatedOn": ISODate("2017-12-06T11:45:13.0Z"), } ] And this what I am getting: "ForgotPassword": { …
0
votes
1 answer

Modify an array element after finding it in swift does not work

I wrote a model like this as an exercise : struct Store { var name : String var bills : Array var category : Category? } struct Bill { var date : String var amount : Float } struct Category { var name : String …
jerome
  • 51
  • 6
0
votes
1 answer

Perl replace strings within specific blocks in a file

hi I am trying to replace strings in a file, test.txt with strings like these :
user1420482
  • 147
  • 3
  • 12
0
votes
2 answers

How to replace strings of spaces with just one space

I am in TextWrangler, trying to grep for all sets of more than one consecutive space. I want to replace all these instances of multiple spaces with a single space. E.g., Find "Cognitive Impenetrability of          Visual Perception" Replace with…
Nick Byrd
  • 163
  • 1
  • 14
0
votes
0 answers

MongoDB findAndModify is atomic in a cluster?

I'm implementing a solution which uses MongoDB findAndModify to simulate resource locks. My question is, does findAndModify offer the same atomicity over replica set as it does on a single instance? This is a sample PHP code $lock =…