Wildcard searching with Batch - windows

Essentially I need to search for a word which can end and start with different things but always contains the same content in the middle.
i.e. 345345hello356
a0a0aphello553
I need to search through the registry for this key under:
HKCU\Software\[KeyBeingLookedFor]
So essentially, get the batch file to look through every key in HKCU\Sotware and if it finds it, spit out Key found via Echo.

Related

read input containing spaces

I have my bash shell script working but I need to take into account the use case where when I read user input it will contain valid white spaces between the words. It can be multiple word so I need to either need a way to read the entire line and parse them or change it that the enter a search string as a unique entry and save it for input to my grep search
Example 1 time out
Example 2 fails to start
Example 3 device failed to respond
Thanks!

Is there a way to remove a word from a KeyedVectors vocab?

I need to remove an invalid word from the vocab of a "gensim.models.keyedvectors.Word2VecKeyedVectors".
I tried to remove it using del model.vocab[word], if I print the model.vocab the word disappeared, but when I run model.most_similar using other words the word that I deleted is still appearing as similar.
So how can I delete a word from model.vocab in a way that affect the model.most_similar to not bring it?
There's no existing method supporting the removal of individual words.
A quick-and-dirty workaround might be to, at the same time as removing the vocab entry, noting the index of the existing vector (in the underlying large vector array), and also changing the string in the kv_model.index2entity list at that index to some plug value (like say, '***DELETED***').
Then, after performing any most_similar(), discard any entries matching '***DELETED***'.
Refer to:
How to remove a word completely from a Word2Vec model in gensim?
Possible method 1: I solve it by editing the text model file itself.
Possible method 2: Refer to #zsozso's answer. (Though I didn't get
it to
work).

File types search pattern in VS find

In the visual studio 2015 find and replace window you can specify file types to look in for:
Looking in *.cs-Files
There, you can enter sth like *.cs which searches in i.e. Program.cs and Class1.cs.
*.as?x searches in Program.asPx and Program.asCx.
I've found no other way to enter a pattern except the wildcard characters *(any item 0 to infinit times) and ?(any item one time).
Is it possible to use any other pattern here to search in cs and resx-files, i.e. *.(resx|cs)[this doesnt work]? Is it possible to use some kind of regex like in the Find what-field?
In Find what you may use the regex defined here.
You can enter a semicolon-separated list of patterns, like this: *.resx;*.cs

Concatenating files with windows copy /b: does not work for overwriting?

I'm trying to concatenate two binary files in Windows. The second of the two files is very large so I would like to avoid making a new file that is the concatenation of the two - instead, I would like the concatenation to appear in place, overwriting the larger file (hopefully this can also be faster?).
I tried the following:
copy /b mysmallfile.dat + mybigfile.dat mybigfile.dat
It asks if I want to overwrite mybigfile.dat, and when I say yes, mybigfile.dat now only contains the contents of mysmallfile.dat, rather than the concatenation of the two.
Very confusingly, if I try:
copy /b mybigfile.dat + mysmallfile.dat mybigfile.dat
It does not ask about overwriting, but does produce a file that is the concatenation of the two! However, the order is incorrect, I need the small file to be first in the concatenation.
I can't understand this behavior or how to get it to work. Any ideas? Thanks!

Find files NOT matching *_abc.*

In dos, when I wanted to get a list of files matching a specific filter, I could use something along the lines of:
*.* - Means return everything
*.txt - Means return all files with a .txt extension
*_abc.* - Means return every file that ends with _abc
My question is, using that dos filter structure, how could I return all files NOT matching *_abc.* (In other words, return all files whos name does NOT end in _abc)?
I don't remember if this is possible and I need this since a company I'm working with is using a very old program that still uses that form of command filtering for selecting files for the program to work on - Also, unfortunately, I can't do it via a batch command... It has to be a single command line statement.
Thanks!!!
Pipe the results of your listing to FINDSTR with an appropriate regex search string and the /V option to filter out matching lines.
dir /b /a-d * | findstr /v /r "_abc\.[^.]*$"
Take a look at this answer to a sort of unrelated question. The answer does show though how to do a REGEX search on file names, and of course if you use a REGEX you can easily search for things that don't match the expression.
https://stackoverflow.com/a/7381962/1246574
Hope that helps.
EDIT
Sorry, didn't see you needed it to be a single line statement and not a batch. I'll leave the above answer though in case it helps anyone else, and I'll also see if I can look up how to do it in a single statement.

Resources