find

How to find a specific value after a specific word in Java?

血红的双手。 提交于 2020-01-06 19:40:32
问题 I got a text from a BufferedReader and I need to get a specific value in a specific string. This is the text: aimtolerance = 1024; model = Araarrow; name = Bow and Arrows; range = 450; reloadtime = 3; soundhitclass = arrow; type = Ballistic; waterexplosionclass = small water explosion; weaponvelocity = 750; default = 213; fort = 0.25; factory = 0.25; stalwart = 0.25; mechanical = 0.5; naval = 0.5; I need to get the exact number between default = and ; Which is "213" 回答1: Something like this..

Find up-to-date files for different paths but with identical file names

末鹿安然 提交于 2020-01-06 15:29:06
问题 I have the following files ./path/to/stuff1/file1 (x) ./path/to/stuff1/file2 ./path/to/stuff1/file3 ./path/to/stuff2/file1 ./path/to/stuff2/file2 (x) ./path/to/stuff2/file3 ./path/to/stuff3/file1 (x) ./path/to/stuff3/file2 ./path/to/stuff3/file3 where I marked the files I touched lastly. I want to get exactly those marked files. In other words: I want to get the up-to-date file for each directory. I constructed the bash command for line in $( find . -name 'file*' -type f | awk -F/ 'sub($NF,x)

FileSystem.GetFiles() + UnauthorizedAccessException error?

余生长醉 提交于 2020-01-06 08:34:11
问题 It seems like FileSystem.GetFiles() is unable to recover from the UnauthorizedAccessException exception that .Net triggers when trying to access an off-limit directory. In this case, does it mean this class/method isn't useful when scanning a whole drive and I should use some other solution (in which case: Which one?)? Here's some code to show the issue: Private Sub bgrLongProcess_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles bgrLongProcess

Get Distinct records from MongoDB using lithium

北慕城南 提交于 2020-01-06 04:16:48
问题 I want to find distinct records from a collected "pages". I tried: $Volume_numbers = Pages::find(array('fields'=>'DISTINCT volume_number')); I also tried: $params = array('conditions'=>array( 'distinct' => 'pages', 'key' => 'volume_number', )); $pageVolumes = Pages::all($params); as suggested in MongoDB documentation and also in one of the answers. When I try to execute this through Mongo, I get correct results > db.runCommand({distinct:'pages',key:'volume_number'}) { "values" : [ 22, 38 ],

return offset of a string with lua

*爱你&永不变心* 提交于 2020-01-06 03:11:10
问题 I'm trying to search rather big files for a certain string and return its offset. I'm new to lua and my current approach would look like this: linenumber = 0 for line in io.lines(filepath) do result=string.find(line,"ABC",1) linenumber = linenumber+1 if result ~= nil then offset=linenumber*4096+result io.close end end I realize that this way is rather primitive and certainly slow. How could I do this more efficiently? Thanks in advance. 回答1: If the file is not too big, and you can spare the

return offset of a string with lua

馋奶兔 提交于 2020-01-06 03:11:06
问题 I'm trying to search rather big files for a certain string and return its offset. I'm new to lua and my current approach would look like this: linenumber = 0 for line in io.lines(filepath) do result=string.find(line,"ABC",1) linenumber = linenumber+1 if result ~= nil then offset=linenumber*4096+result io.close end end I realize that this way is rather primitive and certainly slow. How could I do this more efficiently? Thanks in advance. 回答1: If the file is not too big, and you can spare the

Find and Replace for whole page

眉间皱痕 提交于 2020-01-05 09:09:40
问题 I'm trying to create a Find and Replace for the whole page. I'm Using findandreplace which is a mini-plugin which is: function findAndReplace(searchText, replacement, searchNode) { if (!searchText || typeof replacement === 'undefined') { alert("Please Enter Some Text Into the Field"); return; } var regex = typeof searchText === 'string' ? new RegExp(searchText, 'g') : searchText, childNodes = (searchNode || document.body).childNodes, cnLength = childNodes.length, excludes = 'html,head,style

Python, specific count of chars in string

ε祈祈猫儿з 提交于 2020-01-05 09:03:18
问题 I am trying to count the number of occurrences in a string in python. I would like to take a binary input, say '001101'. Then count the number of 1s, 0s, 11s, 00s etc. I have tried to implement this by using count, but this will output that there are 3 1s, when i only want it to output 1 1, and 1 11s and for it to not count them individually, unless they are on their own. I have also tried to implement this with find, but i am having the same problem. Any help would be appreciated, thanks.

An odd behavior of `find`

微笑、不失礼 提交于 2020-01-05 08:23:15
问题 Under my fetch/evs/ , there is no sub-folder, I have a command which is supposed to list all the files of fetch/evs/*.ev which don't contain text ' Error : find . -ipath '*/fetch/evs/*.ev' | xargs grep -L -e "' Error" > try0.txt This command returns 692 files. What is odd is that it ignores a part of files which satisfy the criteria, for instance if I do: find . -ipath '*/fetch/evs/grades*.ev' | xargs grep -L -e "' Error" > try1.txt This command returns 72 files which are not in try0.txt at

removing extensions in subdirectories

北慕城南 提交于 2020-01-05 04:42:16
问题 I need to remove the extension ".tex": ./1-aoeeu/1.tex ./2-thst/2.tex ./3-oeu/3.tex ./4-uoueou/4.tex ./5-aaa/5.tex ./6-oeua/6.tex ./7-oue/7.tex Please, do it with some tools below: Sed and find Ruby Python My Poor Try: $find . -maxdepth 2 -name "*.tex" -ok mv `sed 's@.tex@@g' {}` {} + 回答1: A Python script to do the same: import os.path, shutil def remove_ext(arg, dirname, fnames): argfiles = (os.path.join(dirname, f) for f in fnames if f.endswith(arg)) for f in argfiles: shutil.move(f, f[: