<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Tech-Recipes - Latest Comments in Convert DOS and Windows line breaks to Unix line breaks</title><link>http://tech-recipes.disqus.com/</link><description>Cookbook of Tech Tutorials</description><atom:link href="https://tech-recipes.disqus.com/convert_dos_line_breaks_to_unix_line_breaks_unix_tech_recipes/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Fri, 01 Oct 2010 18:38:26 -0000</lastBuildDate><item><title>Re: Convert DOS and Windows line breaks to Unix line breaks</title><link>http://www.tech-recipes.com/rx/200/convert-dos-line-breaks-to-unix-line-breaks/#comment-83211027</link><description>&lt;p&gt;That doesn't work either...it just deletes all the "R" characters.&lt;/p&gt;&lt;p&gt;You need to escape the CR and make it global. This works better:&lt;/p&gt;&lt;p&gt;sed -i 's/\r\n/\n/g' file.txt&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Hollister</dc:creator><pubDate>Fri, 01 Oct 2010 18:38:26 -0000</pubDate></item><item><title>Re: Convert DOS and Windows line breaks to Unix line breaks</title><link>http://www.tech-recipes.com/rx/200/convert-dos-line-breaks-to-unix-line-breaks/#comment-2767117</link><description>&lt;p&gt;Running the command:&lt;/p&gt;&lt;p&gt;tr -d '1532' &amp;lt; teste.f &amp;gt; teste1.f&lt;/p&gt;&lt;p&gt;Cleans up my ctrl-m's but not the final ctrl-z. Anyone would happen to know why?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Anonymous</dc:creator><pubDate>Wed, 11 Jan 2006 00:18:12 -0000</pubDate></item><item><title>Re: Convert DOS and Windows line breaks to Unix line breaks</title><link>http://www.tech-recipes.com/rx/200/convert-dos-line-breaks-to-unix-line-breaks/#comment-2767116</link><description>&lt;p&gt;&amp;lt;ul id="quote"&amp;gt;&amp;lt;h6&amp;gt;Doug Merritt wrote:&amp;lt;/h6&amp;gt;Bad advice, doesn't work! This says delete (-d)&lt;br&gt;all sequences of the form "1532"...that's wrong&lt;br&gt;for two reasons.&lt;/p&gt;&lt;p&gt;First, "32" is a typo, that's just&lt;br&gt;a random control character. "12" is the correct&lt;br&gt;octal escape for newline (and 15 is carriage&lt;br&gt;return).&lt;br&gt;&amp;lt;/ul&amp;gt;&lt;/p&gt;&lt;p&gt;15 is r.  Yes, you do want to delete all r's.&lt;/p&gt;&lt;p&gt;32 is CTRL-Z.  DOS text files have an EOF byte: 0x1a or 32 or ^Z.  This also removes that character.  Yes, you do want to delete all ^Z's.&lt;/p&gt;&lt;p&gt;So this is good advice and does work.  Did you try it?&lt;/p&gt;&lt;p&gt;I do agree with the other poster who said to use -i to edit the file in place, though.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Anonymous</dc:creator><pubDate>Fri, 17 Dec 2004 13:24:40 -0000</pubDate></item><item><title>Re: Convert DOS and Windows line breaks to Unix line breaks</title><link>http://www.tech-recipes.com/rx/200/convert-dos-line-breaks-to-unix-line-breaks/#comment-2767115</link><description>&lt;p&gt;sed is made for these kind of things...&lt;/p&gt;&lt;p&gt;&amp;gt; sed -i "s/r//" file.txt&lt;/p&gt;&lt;p&gt;If you want to keep a backup of the file just specify an extension.&lt;/p&gt;&lt;p&gt;&amp;gt; sed -i.bak "s/r//" file.txt&lt;/p&gt;&lt;p&gt;Above line will create file.txt.bak as a copy of the original file.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">lazy</dc:creator><pubDate>Mon, 08 Nov 2004 06:15:03 -0000</pubDate></item><item><title>Re: Convert DOS and Windows line breaks to Unix line breaks</title><link>http://www.tech-recipes.com/rx/200/convert-dos-line-breaks-to-unix-line-breaks/#comment-2767114</link><description>&lt;p&gt;The quickest fix is to just delete all carriage&lt;br&gt;returns, leaving the newlines in place:&lt;/p&gt;&lt;p&gt;      tr -d '15" &amp;lt; dos-format-file &amp;gt; unix-friendly-file&lt;br&gt;or better&lt;br&gt;      tr -d "r" &amp;lt; dos_file &amp;gt; unix_file&lt;/p&gt;&lt;p&gt;There's also "dos2unix", which comes with most&lt;br&gt;Linux/Unix systems I've seen in the last 10 years:&lt;/p&gt;&lt;p&gt;     dos2unix -n dos_file new_unix_file&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Doug Merritt</dc:creator><pubDate>Sun, 02 Nov 2003 04:19:10 -0000</pubDate></item><item><title>Re: Convert DOS and Windows line breaks to Unix line breaks</title><link>http://www.tech-recipes.com/rx/200/convert-dos-line-breaks-to-unix-line-breaks/#comment-2767113</link><description>&lt;p&gt;Or in a singl e shot&lt;br&gt;perl -pi -s 'rn/n/'  filename&lt;br&gt;dos2unix filename.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">.</dc:creator><pubDate>Fri, 24 Oct 2003 22:54:08 -0000</pubDate></item></channel></rss>