{"id":130,"date":"2008-06-16T10:05:37","date_gmt":"2008-06-16T18:05:37","guid":{"rendered":"http:\/\/www.curlybrace.com\/words\/?p=130"},"modified":"2008-10-15T22:36:25","modified_gmt":"2008-10-16T06:36:25","slug":"stripping-vertical-whitespace-tr","status":"publish","type":"post","link":"https:\/\/www.curlybrace.com\/words\/2008\/06\/stripping-vertical-whitespace-tr\/","title":{"rendered":"Stripping Vertical Whitespace Using <tt>tr<\/tt>"},"content":{"rendered":"<p>The Translate command, <tt>tr<\/tt>, is available on all Unix-y systems, including <a href=\"http:\/\/www.cygwin.com\">Cygwin<\/a>.  <tt>tr -d<\/tt> will delete the specified characters from a stream.   Several handy escape sequences are provided for stripping newlines, carriage returns, and form-feeds:<\/p>\n<ul>\n<li \/><tt>\\f<\/tt> &#8211; form feed\n<li \/><tt>\\n<\/tt> &#8211; new line\n<li \/><tt>\\r<\/tt> &#8211; return\n<\/ul>\n<p>Since <tt>tr<\/tt> is deleting <i>characters<\/i>, not strings, we can simply specify all of these in a single command:<\/p>\n<blockquote><p><tt>cat input.txt | tr -d \\r\\n\\f > output.txt<\/tt><\/p><\/blockquote>\n<p>Another way to assemble this command:<\/p>\n<blockquote><p><tt>tr -d \\r\\n\\f < input.txt > output.txt<\/tt><\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>The Translate command, tr, is available on all Unix-y systems, including Cygwin. tr -d will delete the specified characters from a stream. Several handy escape sequences are provided for stripping newlines, carriage returns, and form-feeds: \\f &#8211; form feed \\n &hellip; <a href=\"https:\/\/www.curlybrace.com\/words\/2008\/06\/stripping-vertical-whitespace-tr\/\">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":[200,193,15],"tags":[],"class_list":["post-130","post","type-post","status-publish","format-standard","hentry","category-linux","category-scripting","category-technology"],"_links":{"self":[{"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/posts\/130","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/comments?post=130"}],"version-history":[{"count":1,"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/posts\/130\/revisions"}],"predecessor-version":[{"id":409,"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/posts\/130\/revisions\/409"}],"wp:attachment":[{"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/media?parent=130"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/categories?post=130"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/tags?post=130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}