Bash/Vi Issue

So I’m trying to dig my Windows product key out of my recovered files. I run this pattern on all of them with ‘egrep -r ‘^([A-Za-z0-9]{5}-){4}[A-Za-z0-9]{5}$’ *’

It says it finds it in three files:

Binary file recup_dir.7567/f2079240352_unregmp2 matches
Binary file recup_dir.7574/f2082184960_pidgen_dll matches
Binary file recup_dir.7576/f2082580864_pidgen_dll matches

But when I go into vi to search for the string itself with the same regex, I get “No pattern matches.” Is the syntax for regex different in vi than in bash?

[Wednesday update]

I still haven’t found it, but amazingly, I seem to have installed a working version of Windows 10 without it.

11 thoughts on “Bash/Vi Issue”

  1. Rand — You may find some help in a handly little O’Reilly book titled “Regular Expressions Pocket Reference” (ISBN 978-0-596-51427-3).

    1. I have always found that, unless you use them Every Day, Regular Expressions are unusable, except for the most basic ones.

  2. Hopefully a vi user will weigh in, but vim looks like if has it’s own search patterns with regex-like stuff bolted on top. See

    http://vimdoc.sourceforge.net/htmldoc/usr_27.html#27.4

    I think this might do it, but I’m not really a vi user:

    ^(/[A-Za-z0-9]\{5}-)\{4}/[A-Za-z0-9]\{5}$

    You may need to drop the ^ and $ since I don’t see them in the docs.

    Finally note that you are using egrep, not bash for your initial find, so the answer would be the same for tcsh, zsh, etc. Should be egrep/vi rather than bash/vi.

    1. Actually, do you need context? If not, maybe adding -o (and possibly -a as well) to your grep might remove the need to open the file in vi at all?

  3. I believe Windows 10 Lets you install without it but has a phone home feature that validates it that may kicked it into a cripple mode. Think it also may have hooks to a Microsoft account.

    Though what the history of the system was it home built? Or a OEM that came with windows , that you installed linux on top?. If it was a OEM they been stashing those product codes in the EFI/BIOS so can just reinstall with nothing.

      1. I still haven’t found it, but amazingly, I seem to have installed a working version of Windows 10 without it.

        Consider yourself lucky and don’t look back.

  4. The good news is that it looks like Windows is moving toward Linux. The bad news is that regular people will soon be faced with more complicated troubleshooting.

Comments are closed.