Skip to content

Instantly share code, notes, and snippets.

@alpinskiy
Created July 4, 2012 14:37
Show Gist options
  • Save alpinskiy/3047690 to your computer and use it in GitHub Desktop.
Save alpinskiy/3047690 to your computer and use it in GitHub Desktop.
Snippets to compare Windows Registry (version 5.0) *.reg files
" Delete large binary data blocks
g/ \x\{2}\(,\x\{2}\)*\(,\\\)\=/ d
" Sort values inside [] sections
g/\[*\]\n\p/+1,/^$/-1 sort
" Join section [] content together with $
g/\[*\]\n\p/,/^$/-1 s/$\n/ $ /
" Delete empty lines
%s/^$\n//
" Sort joined content
sort
" diff -a -u <first_file> <second_file>
" Extract changes from 1st file
g!/-\[.*\]/ d
" Extract changes from 2nd file
g!/+\[.*\]/ d
" Delete +/- at the begging of the line
%s/^[-+]\[/\[/
" Expand joined [] section content
%s/ \$ $/\r/
%s/ \$ /\r/g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment