Recently I had the need to change the formatting of some guid values in a .csv file. Turns out, this is pretty easy to do in Powershell. To change "0d2c3b6e-b10a-4fc3-9cdd-499dc16c81fa" into {0d2c3b6e-b10a-4fc3-9cdd-499dc16c81fa} use this nice Powershell trickery: $ line = "`" $( New-Guid ) `",`"blablabla`",`"blablabla`",`" $( New-Guid ) `",`"blablabla`"" $ line $ line -replace '\"([0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12})\"' , '{${1}}' Or using Notepad++: Search for: (")([0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12})(") Replace by: {\2}
Tips & Tricks for the Sql Server DBA