grepWin & Notepad++: Opening files at the line number.

Worked out a cool tip to combine grepWin & Notepad++ to open files at the line number of the search.

In grepWin, click on the settings button in the middle of the screen (next to the “Only one instance” checkbox.
Add this to the Editor box:

C:\Program Files (x86)\Notepad++\notepad++.exe -n%line% "%path%"

You’ll need to update the location of your Notepad++ if it’s not installed in the default location.

UPDATE: I discovered you need to add quotes around the %path% to open documents with spaces in the full path name!

Regex to create list of values for SQL statement

In my day I’m currently undertaking a lot of data migrations. One thing I have to do frequently is find a list of records that do and/or don’t exist in one or more tables. This usually involves getting a list of ID’s from a log output text files then doing SQL queries to attempt to find them!

Unfortunately our clients machines are generally Windows based. Thankfully most are kind enough to allow us to use/install Notepad++ (IMO  the best notepad software available on Windows).

As such I utilise Regex a lot to find/strip/edit the contents to get the ID’s out and today I had a brainwave I thought I’d share on how to get it out quickly and turn it into a list that you can cut and paste into a WHERE clause of a SQL statement.

In our case the format of the logs are:

What I want is:

'',

And I get there with:

s/^(.*)/'\1',/

Or in Notepad++:

Enjoy!