find

How to change a string in the vim editor?

非 Y 不嫁゛ 提交于 2019-12-13 10:00:28
问题 I am trying to replace a string with slashes in vim editor ex: foo to abc/def/foo . Any suggestions? 回答1: The title and the content of your question don't match. :help pattern and :help :substitute are a bit overwhelming but very useful as regular expressions are at the heart of Vim. Vim regular Expressions 101 is a more concise resource. Anyway, given the following sample text: bar baz foo baz bar your goal can be achieved in a variety of ways. Here are some of them: :s/foo/\/abc\/def\/foo

How can I redirect stderr to a file?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 09:23:01
问题 What is the command required to redirect the standard error descriptor to a file called error.txt in unix? I have this command so far: find / -name "report*" ________ error.txt 回答1: You can use the stderr handler 2 like this: find / -name "report*" 2>error.txt See an example: $ ls a1 a2 ls: cannot access a2: No such file or directory <--- this is stderr a1 <--- this is stdin $ ls a1 a2 2>error.txt a1 $ cat error.txt ls: cannot access a2: No such file or directory <--- just stderr was stored

How does the find command search for files

一笑奈何 提交于 2019-12-13 08:58:51
问题 Quarrying out from another thread Move file that has aged x minutes, this question came up: How does the find command found typically in Linux search for files in the current directory? Consider a directory that contains a fairly large amount of files, then: Firstly find MY_FILE.txt returns immediately and secondly find . -name MY_FILE.txt takes much longer. I used strace -c to see what happens for both and I learned that the second command invokes a directory scan, which explains why it's

Find File Directory By Searching Through Hard Drive

萝らか妹 提交于 2019-12-13 08:56:16
问题 So I am trying to search through a specific hard drive (for example, C:) to find a file (like "HxD.exe"), and I am trying to get the specific directory to that file to launch with CreateProcess() . I know that this question has been answered before, but I have tried all those methods and none of them have worked for me (well, one worked but the type of string it gave me couldn't be converted to what CreateProcess() was looking for without losing data). Perhaps I am just doing it wrong?

Find the two longest strings from a list || or the second longest list in PYTHON

余生颓废 提交于 2019-12-13 08:37:59
问题 I'd like to know how i can find the two longest strings from a list(array) of strings or how to find the second longest string from a list. thanks 回答1: You can do this using the standard heapq module: >>> lst = ['hello', 'blah', 'boo', 'braininess'] >>> heapq.nlargest(2, lst, key=len) ['braininess', 'hello'] 回答2: Easiest way to do this is use the sorted() function by using another built-in function len as the key argument as follows; >>> foo = ['dddd', 'ccc', 'bb', 'a', 'eeeee'] >>> sorted

shell to find a file , execute it - exit if 'error' and continue if ' no error'

 ̄綄美尐妖づ 提交于 2019-12-13 08:13:37
问题 I have to write a shell script and i don't know how to go about it. Basically i have to write a script where i'd find a file ( it could be possibly named differently). If either file exists then it must be executed, if it returns a 0 ( no error), it should continue the build, if it's not equal to 0 ( returns with error), it should exit. If either file is not found it should continue the build. the file i have to find could be either file.1 or file.2 so it could be either named (file.1), or

find and delete a word in a text by batch file

梦想与她 提交于 2019-12-13 07:52:38
问题 Hi all I want to find and delete some word by a batch file i tried this: @Echo OFF REM Set These Variables SET "InFile=Unloaded.txt" SET "OutFile=NowLoaded.txt" SET "Replace=%r%" SET "ReplaceWith= " REM Get Total Lines Number [including empty lines] FOR /F %%A IN ('TYPE "%InFile%"^|find /v /c ""') DO SET "Till=%%A" REM Create The OutFile with changes SETLOCAL EnableDelayedExpansion <"!InFile!" ( FOR /L %%a IN (1 1 0) DO SET /p "=" FOR /L %%A IN (1 1 %Till%) DO ( SET "line=" SET /P "line=" IF

coding a VBA excel function to search a string in a range

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 07:41:17
问题 I am a rookie on excel... I am trying to create a function that takes a text string as parameter, trims it (ie removes the extra spaces at the end and at the beginning), searches for the first occurrence of the string in a range (on another spreadsheet), and returns the actual content of that cell.. I've written the code below but however I tweak it, it never returns anything!! Any help would be much appreciated ! Note: online I've found several examples of "subs" that do similar things, but

How can you search only filenames by find? [closed]

痞子三分冷 提交于 2019-12-13 07:41:09
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . This question is based on the answer. I run at home find -- ./ Desktop I understand the command as find without parameters at the current directory that is home (= /Users/masi/) find the folder name Desktop at the current directory How do you read the command? 回答1: I think what you want is: find ./ -name Desktop

Cakephp contain and belongsTo hasMany conditions

十年热恋 提交于 2019-12-13 07:37:48
问题 From the CakePHP manual: Let's say you had a belongsTo relationship between Posts and Authors. Let's say you wanted to find all the posts that contained a certain keyword ("magic") or were created in the past two weeks, but you want to restrict your search to posts written by Bob: array ( "Author.name" => "Bob", "OR" => array ( "Post.title LIKE" => "%magic%", "Post.created >" => date('Y-m-d', strtotime("-2 weeks")) ) ) However, its not working for me. I've got Scrapes belongsTo Vargroup, and