<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Removing ^M from string in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/removing-m-from-string/m-p/3915621#M97005</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;if you run perl under windows, you may have to use 'binmode' before you use 'print'.&lt;BR /&gt;&lt;BR /&gt;In your example, the syntax must be adjusted; I suggest:&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;($var1 = $var) =~ s/\r//;&lt;BR /&gt;print $var1;&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
    <pubDate>Wed, 20 Dec 2006 03:00:35 GMT</pubDate>
    <dc:creator>Peter Nikitka</dc:creator>
    <dc:date>2006-12-20T03:00:35Z</dc:date>
    <item>
      <title>Removing ^M from string</title>
      <link>https://community.hpe.com/t5/operating-system-linux/removing-m-from-string/m-p/3915617#M97001</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;  I try this to remove "^M" from a string.. but does not seem to work.. anyone know why??&lt;BR /&gt;.....&lt;BR /&gt;my $var = "testing123^M";&lt;BR /&gt;$var = s/^V^M//;&lt;BR /&gt;print "var=$var";&lt;BR /&gt;....&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Henry&lt;BR /&gt;</description>
      <pubDate>Tue, 19 Dec 2006 21:17:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/removing-m-from-string/m-p/3915617#M97001</guid>
      <dc:creator>Henry Chua</dc:creator>
      <dc:date>2006-12-19T21:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: Removing ^M from string</title>
      <link>https://community.hpe.com/t5/operating-system-linux/removing-m-from-string/m-p/3915618#M97002</link>
      <description>If you have a whole file, use the dos2ux command.&lt;BR /&gt;&lt;BR /&gt;# dos2ux file1 &amp;gt; file2&lt;BR /&gt;&lt;BR /&gt;will remove all ^M sequences from file1 and save it in file2.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 19 Dec 2006 21:27:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/removing-m-from-string/m-p/3915618#M97002</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2006-12-19T21:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: Removing ^M from string</title>
      <link>https://community.hpe.com/t5/operating-system-linux/removing-m-from-string/m-p/3915619#M97003</link>
      <description>Hi Patrick, &lt;BR /&gt;&lt;BR /&gt; I'll like to implement this to control the string parse to a text so i am using perl to do this. Thanks.&lt;BR /&gt;&lt;BR /&gt;Best regards&lt;BR /&gt;Henry</description>
      <pubDate>Tue, 19 Dec 2006 21:34:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/removing-m-from-string/m-p/3915619#M97003</guid>
      <dc:creator>Henry Chua</dc:creator>
      <dc:date>2006-12-19T21:34:11Z</dc:date>
    </item>
    <item>
      <title>Re: Removing ^M from string</title>
      <link>https://community.hpe.com/t5/operating-system-linux/removing-m-from-string/m-p/3915620#M97004</link>
      <description>&lt;BR /&gt;&lt;BR /&gt;Henry,&lt;BR /&gt;&lt;BR /&gt;The ^M or 'CR = Carriage Return" is best represented in perl as \r&lt;BR /&gt;You could also use the octal code \012.&lt;BR /&gt;&lt;BR /&gt;Compare this with the more common ^J or 'LF = LineFeed'&lt;BR /&gt;For that one you know to use \n or \015.&lt;BR /&gt;&lt;BR /&gt;See: &lt;A href="http://www.perl.com/doc/manual/html/pod/perlop.html" target="_blank"&gt;http://www.perl.com/doc/manual/html/pod/perlop.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Look for 'interpolation'&lt;BR /&gt;&lt;BR /&gt;And also check an ascii table. For example:&lt;BR /&gt;&lt;A href="http://www.asciitable.com/" target="_blank"&gt;http://www.asciitable.com/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Tue, 19 Dec 2006 23:04:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/removing-m-from-string/m-p/3915620#M97004</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2006-12-19T23:04:53Z</dc:date>
    </item>
    <item>
      <title>Re: Removing ^M from string</title>
      <link>https://community.hpe.com/t5/operating-system-linux/removing-m-from-string/m-p/3915621#M97005</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;if you run perl under windows, you may have to use 'binmode' before you use 'print'.&lt;BR /&gt;&lt;BR /&gt;In your example, the syntax must be adjusted; I suggest:&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;($var1 = $var) =~ s/\r//;&lt;BR /&gt;print $var1;&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Wed, 20 Dec 2006 03:00:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/removing-m-from-string/m-p/3915621#M97005</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2006-12-20T03:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: Removing ^M from string</title>
      <link>https://community.hpe.com/t5/operating-system-linux/removing-m-from-string/m-p/3915622#M97006</link>
      <description>As Hein said. CR is \r, not ^M&lt;BR /&gt;If you want to denote it in CTRL terms, perl offers you \cM, but that is unportable (think EBCDIC), as you now tell exactly which codepoint you use instead of using the correct escape&lt;BR /&gt;&lt;BR /&gt;^V^M is a vi or shell notation. Ctrl-V tells both to take the next character literally. Perl doesn't know about that.&lt;BR /&gt;&lt;BR /&gt;As \r (or \cM) is whitespace, it also falls in that category, and&lt;BR /&gt;&lt;BR /&gt;(my $var = "testing123 \r") =~ s/\s+$//;&lt;BR /&gt;&lt;BR /&gt;will now remove both the \r and the space&lt;BR /&gt;&lt;BR /&gt;Note also that you 'print "var = $var";' will not print a newline unless you used the -l option on perl invocation. That should probably be 'print "var = $var\n";'&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Wed, 20 Dec 2006 03:05:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/removing-m-from-string/m-p/3915622#M97006</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2006-12-20T03:05:21Z</dc:date>
    </item>
    <item>
      <title>Re: Removing ^M from string</title>
      <link>https://community.hpe.com/t5/operating-system-linux/removing-m-from-string/m-p/3915623#M97007</link>
      <description>try those 2 ways&lt;BR /&gt;&lt;BR /&gt;cat &lt;FILENAME1&gt; | tr -d "^V^M" &amp;gt; &lt;NEWFILE&gt;    &lt;BR /&gt;&lt;BR /&gt;sed -e "s/^V^M//" &lt;FILENAME&gt; &amp;gt; &lt;OUTPUT filename=""&gt;&lt;/OUTPUT&gt;&lt;/FILENAME&gt;&lt;/NEWFILE&gt;&lt;/FILENAME1&gt;</description>
      <pubDate>Thu, 21 Dec 2006 04:07:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/removing-m-from-string/m-p/3915623#M97007</guid>
      <dc:creator>PAVIC Thierry</dc:creator>
      <dc:date>2006-12-21T04:07:33Z</dc:date>
    </item>
  </channel>
</rss>

