{"id":214,"date":"1997-09-09T01:36:29","date_gmt":"1997-09-09T09:36:29","guid":{"rendered":"http:\/\/www.birdhouse.org\/betips\/?p=214"},"modified":"1997-09-09T01:36:29","modified_gmt":"1997-09-09T09:36:29","slug":"clean-up-macos-or-windows-text","status":"publish","type":"post","link":"https:\/\/www.betips.net\/?p=214","title":{"rendered":"Clean up MacOS or Windows text"},"content":{"rendered":"<p>Bring text files over from MacOS or Windows and they&#8217;ll display improperly in BeOS, which uses Unix-style line endings. While there are a variety of tools available on BeWare and BeBits that will take care of this, you can fix these files yourself by using the built-in <code>tr<\/code> command, for translate. You can get full details on tr with <code>tr --help<\/code>, but if you just want to fix files fast, here&#8217;s the ticket:<br \/>\nTo fix DOS\/Windows text files, use:<br \/>\ncat original_file | tr -d &#8218; &#8218; > new_file<br \/>\nTo fix Mac text, use:<br \/>\ncat original_file | tr &#8218; &#8218; &#8218; &#8218; > new_file<\/p>\n<hr \/>\n<p>Pete Goodeve (pete@jwgibbs.cchem.berkeley.edu) adds the following alternative method and explanatory text:<br \/>\nIf you import a text file from the Microsoft world to use under BeOS (or in Unix for that matter), you are likely to be frustrated by the carriage-return characters that precede every newline in the file (a habit that dates from the days of mechanical teletypes). There is usually at least one &#8218;control-Z&#8216; marking the end-of-file as well, probably adding to the confusion. These characters may simply show up as rectangles in StyledEdit, or worse, may interfere with compilation.<br \/>\nIt is very simple to get rid of these with the following command line, typed in a Terminal: <\/p>\n<pre> tr -d \\r\\032 &amp;lt;original-text &amp;gt;clean-text <\/pre>\n<p> (&#8218;tr&#8216; &#8222;translates&#8216; characters, &#8218;-d&#8216; means to simply delete rather than actually translate, &#8218; &#8218; represents the carriage-return character &#8212; with the backslash doubled so that is recognized as itself &#8212; , and &#8218; 32&#8216; &#8212; all three digits needed &#8212; is the code for control-Z. &#8218;original-text&#8216; should of course be replaced by the name of the file causing trouble; &#8218;clean-text&#8216; is where you want to put the useable version.)<br \/>\nBy the way, if you have to convert a lot of such files, and you have <a HREF=\"http:\/\/jwgibbs.cchem.berkeley.edu\/~pete\/beos\/xicon.html\"> xicon<\/a>, a script is <a HREF=\"http:\/\/jwgibbs.cchem.berkeley.edu\/~pete\/beos\/xicon.html#scripts\"> available<\/a> that does the same thing via drag&amp;drop.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Bring text files over from MacOS or Windows and they&#8217;ll display improperly in BeOS, which uses Unix-style line endings. While there are a variety of tools available on BeWare and BeBits that will take care of this, you can fix these files yourself by using the built-in tr command, for translate. You can get full [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[11],"class_list":["post-214","post","type-post","status-publish","format-standard","hentry","tag-terminal"],"_links":{"self":[{"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/posts\/214","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.betips.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=214"}],"version-history":[{"count":0,"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/posts\/214\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.betips.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=214"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.betips.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=214"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.betips.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=214"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}