{"id":440,"date":"2015-10-27T16:02:04","date_gmt":"2015-10-27T15:02:04","guid":{"rendered":"http:\/\/dev.flauschig.ch\/wordpress\/?p=440"},"modified":"2015-10-27T16:02:36","modified_gmt":"2015-10-27T15:02:36","slug":"improve-visual-studio-find-in-files-results","status":"publish","type":"post","link":"http:\/\/dev.flauschig.ch\/wordpress\/?p=440","title":{"rendered":"Improve Visual Studio Find In Files Results"},"content":{"rendered":"<p>The search result window from Visual Studio is not really the best. Sometimes it can be hard to find what you&#8217;re searching for, especially when you have long file paths. Unfortunately you cannot even copy\/past the results to Excel and filter\/sort there.<\/p>\n<p>Luckily there is a hidden Registry Key you can use to format the output on your own.<\/p>\n<p>The Registry Key is in\u00a0 <code>HKCU\\Software\\Microsoft\\VisualStudio\\&lt;your VS Version&gt;\\Find<\/code>\u00a0and should be named <code>Find result format<\/code> (type is string). Just create it if it doesn&#8217;t exist.<\/p>\n<p>It holds a formatting string and you can use a combination of the following variables:<\/p>\n<table>\n<tbody>\n<tr>\n<td><strong>Value<\/strong><\/td>\n<td><strong>Explanation<\/strong><\/td>\n<td><strong>Example<\/strong><\/td>\n<\/tr>\n<tr>\n<td>\u00a0$p<\/td>\n<td>Path<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\u00a0$f<\/td>\n<td>Filename<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\u00a0$v<\/td>\n<td>drive \/ unc share<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\u00a0$d<\/td>\n<td>Directory<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\u00a0$n<\/td>\n<td>Name<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\u00a0$e<\/td>\n<td>Extension<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\u00a0$l<\/td>\n<td>Line<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\u00a0$c<\/td>\n<td>Column<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\u00a0$x<\/td>\n<td>end col if on first line, else end of first line<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>$L<\/td>\n<td>span end line<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>$C<\/td>\n<td>span end col<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>$0<\/td>\n<td>Matched text<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>$t<\/td>\n<td>text of first line<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>$s<\/td>\n<td>summary of hit<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>$T<\/td>\n<td>Test of spanned lines<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\\n<\/td>\n<td>Newline<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\\s<\/td>\n<td>Space<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\\t<\/td>\n<td>Tab<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\\\\<\/td>\n<td>Slash<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\\$<\/td>\n<td>$<\/td>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>My favorite is\u00a0<span class=\"lang:default decode:true crayon-inline\">$p($l,$c):\\t\\t\\t$s\\r\\n<\/span> This one allows you to copy\/paste the result to Excel for very easy further filtering and sorting (columns are detected correctly because of the tabs).<\/p>\n<p>Another nice one is <span class=\"lang:default decode:true crayon-inline\">$f$e($l,$c):$t\\r\\n<\/span> which just shows the file names and not the entire paths.<\/p>\n<div><em>Sources:<\/em><\/div>\n<ul style=\"list-style-type: circle;\">\n<li><a href=\"http:\/\/blogs.msdn.com\/b\/saraford\/archive\/2006\/03\/30\/customize-your-find-in-files-results-experience.aspx\">http:\/\/blogs.msdn.com\/b\/saraford\/archive\/2006\/03\/30\/customize-your-find-in-files-results-experience.aspx<br \/>\n<\/a><\/li>\n<li><a href=\"http:\/\/blogs.msdn.com\/b\/zainnab\/archive\/2010\/01\/03\/customize-how-search-results-are-displayed-in-the-find-results-window.aspx\">http:\/\/blogs.msdn.com\/b\/zainnab\/archive\/2010\/01\/03\/customize-how-search-results-are-displayed-in-the-find-results-window.aspx<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>The search result window from Visual Studio is not really the best. Sometimes it can be hard to find what you&#8217;re searching for, especially when you have long file paths. Unfortunately you cannot even copy\/past the results to Excel and filter\/sort there. Luckily there is a hidden Registry Key you can use to format the &hellip; <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[14,101],"tags":[],"class_list":{"0":"entry","1":"post","2":"publish","3":"author-roemer","4":"post-440","6":"format-standard","7":"category-tools","8":"category-visualstudio"},"acf":[],"views":2458,"_links":{"self":[{"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/440"}],"collection":[{"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=440"}],"version-history":[{"count":0,"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/440\/revisions"}],"wp:attachment":[{"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=440"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=440"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=440"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}