{"id":877,"date":"2014-02-07T21:09:39","date_gmt":"2014-02-07T20:09:39","guid":{"rendered":"https:\/\/www.ssl-id.de\/sslblog.philippgoecke.de\/?p=877"},"modified":"2014-02-07T21:12:53","modified_gmt":"2014-02-07T20:12:53","slug":"remove-blank-lines-from-text-file","status":"publish","type":"post","link":"https:\/\/stls.eu\/blog\/2014\/02\/07\/remove-blank-lines-from-text-file\/","title":{"rendered":"remove blank lines from text file"},"content":{"rendered":"<pre>sed '\/^$\/d' \/path\/to\/input\/file.txt > output.txt\r\ngrep -v '^$' \/path\/to\/input\/file.txt > output.txt<\/pre>\n<pre>#!\/bin\/bash\r\nfiles=\"\/path\/to\/input\/files\/*.txt\"\r\nfor i in $files\r\ndo\r\n  sed '\/^$\/d' $i > $i.out\r\n  mv  $i.out $i\r\ndone<\/pre>\n<pre>#!\/bin\/bash\r\nfiles=\"\/path\/to\/input\/files\/*.txt\"\r\nfor i in $files\r\ndo\r\n  sed '\/^ *$\/d' $i > $i.out\r\n  mv $i.out $i\r\ndone<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>sed &#8216;\/^$\/d&#8217; \/path\/to\/input\/file.txt > output.txt grep -v &#8216;^$&#8217; \/path\/to\/input\/file.txt > output.txt #!\/bin\/bash files=&#8221;\/path\/to\/input\/files\/*.txt&#8221; for i in $files do sed &#8216;\/^$\/d&#8217; $i > $i.out mv $i.out $i done #!\/bin\/bash files=&#8221;\/path\/to\/input\/files\/*.txt&#8221; for i in $files do sed &#8216;\/^ *$\/d&#8217; $i > $i.out &hellip; <a href=\"https:\/\/stls.eu\/blog\/2014\/02\/07\/remove-blank-lines-from-text-file\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-877","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/stls.eu\/blog\/wp-json\/wp\/v2\/posts\/877","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/stls.eu\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/stls.eu\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/stls.eu\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/stls.eu\/blog\/wp-json\/wp\/v2\/comments?post=877"}],"version-history":[{"count":2,"href":"https:\/\/stls.eu\/blog\/wp-json\/wp\/v2\/posts\/877\/revisions"}],"predecessor-version":[{"id":879,"href":"https:\/\/stls.eu\/blog\/wp-json\/wp\/v2\/posts\/877\/revisions\/879"}],"wp:attachment":[{"href":"https:\/\/stls.eu\/blog\/wp-json\/wp\/v2\/media?parent=877"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stls.eu\/blog\/wp-json\/wp\/v2\/categories?post=877"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stls.eu\/blog\/wp-json\/wp\/v2\/tags?post=877"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}