{"id":9957,"date":"2021-12-05T00:38:02","date_gmt":"2021-12-05T00:38:02","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=9957"},"modified":"2021-12-05T00:39:42","modified_gmt":"2021-12-05T00:39:42","slug":"using-findstr-to-locate-whitespace-lines","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/using-findstr-to-locate-whitespace-lines\/21591.html","title":{"rendered":"Using FINDSTR To Locate Whitespace Lines"},"content":{"rendered":"<p>I have a file where some lines consist of whitespaces only. I need to skip those lines and only display lines that are not whitespaces.<\/p>\n<p>Say, the file looks like this:<\/p>\n<p>&nbsp;<\/p>\n<pre><b>Beginnng of file.\r\n                                                   \r\n                                                   \r\nMiddle of file.\r\n                                                   \r\n\t                                   \r\nThis is next to end line of file.\r\nThis is end of file.<\/b><\/pre>\n<p>I have the following batch script:<\/p>\n<p>&nbsp;<\/p>\n<pre><b>@ECHO OFF\r\nSETLOCAL ENABLEDELAYEDEXPANSION\r\nFOR \/F \"usebackq delims=\" %%a in (\"file.txt\") DO (\r\n    ECHO.%%a | findstr \"^[\\t ]*$\"\r\n    IF errorlevel=1 ECHO.%%a\r\n)\r\nSETLOCAL DISABLEDELAYEDEXPANSION<\/b><\/pre>\n<p>I am expecting to see the following result:<\/p>\n<p>&nbsp;<\/p>\n<pre><b>Beginning of file.\r\nMiddle of file.\r\nThis is next to end line of file.\r\nThis is end of file.<\/b><\/pre>\n<p>However it&#8217;s not working. My regular expression is incorrect. Please help me fix it.<\/p>\n<p>-Greg.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":1},"question-category":[55],"question_tags":[],"class_list":["post-9957","question","type-question","status-publish","hentry","question-category-programming"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question\/9957","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question"}],"about":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/types\/question"}],"author":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/comments?post=9957"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=9957"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=9957"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=9957"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}