<?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: Remove ^M character from file in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162602#M903041</link>
    <description>&lt;BR /&gt;Their are many ways to do this. more than 3 that were shown. some better than others&lt;BR /&gt;&lt;BR /&gt;The best way is to ftp the files correctly&lt;BR /&gt;&lt;BR /&gt;OK here is MYLIST OF POSSIBLE solutions:  &lt;BR /&gt;&lt;BR /&gt;for arg in files*&lt;BR /&gt;do&lt;BR /&gt;strings $arg $arg.tmp&lt;BR /&gt;   or&lt;BR /&gt;cat $arg |tr -d "\r" &amp;gt; $arg.tmp&lt;BR /&gt;   or&lt;BR /&gt;dos2ux $arg &amp;gt; $arg.tmp&lt;BR /&gt;   or&lt;BR /&gt;awk 'gsub(/\r$/,"")' $arg &amp;gt; $arg.tmp&lt;BR /&gt;  or&lt;BR /&gt;sed 's/^M$//' $arg &amp;gt; $arg.tmp&lt;BR /&gt; # thats s/ctrl+v ctrl+M$//&lt;BR /&gt; mv $arg.tmp $arg&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;ed, ex and vi&lt;BR /&gt;&lt;BR /&gt;for arg in files&lt;BR /&gt;do&lt;BR /&gt;  echo "1,$ s/\r$//g\n.\nw\nq" |ed $arg&lt;BR /&gt;      or&lt;BR /&gt;  echo "1,$ s/\r$//g\nwq" |ex $arg&lt;BR /&gt;      or&lt;BR /&gt;  echo "^\1,$ s/\r$//g\nwq" |vi $arg&lt;BR /&gt;done  &lt;BR /&gt;&lt;BR /&gt;Some of the above deletes ^M at the end of line ignoring  ^M that could be embeded in the  middle (unlikely with text files)&lt;BR /&gt;to delete all ^M change \r$ to \r&lt;BR /&gt;&lt;BR /&gt;Thanks that was fun!&lt;BR /&gt;&lt;BR /&gt;Rory</description>
    <pubDate>Wed, 14 Jan 2004 19:45:49 GMT</pubDate>
    <dc:creator>Rory R Hammond</dc:creator>
    <dc:date>2004-01-14T19:45:49Z</dc:date>
    <item>
      <title>Remove ^M character from file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162581#M903020</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I ftp'ed few files from my Windows machine to HP-UX machine.  But, the *.ksh files contain &lt;BR /&gt;^M character.  How can I get rid of the characters ?  Is there a software that can be installed on UX box to convert all the files ?&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Nameesh.</description>
      <pubDate>Tue, 13 Jan 2004 02:55:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162581#M903020</guid>
      <dc:creator>Nameesh</dc:creator>
      <dc:date>2004-01-13T02:55:14Z</dc:date>
    </item>
    <item>
      <title>Re: Remove ^M character from file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162582#M903021</link>
      <description>Hi!&lt;BR /&gt;&lt;BR /&gt;There's a Utility which is called dos2unix which is able to convert these Files. &lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;oliver</description>
      <pubDate>Tue, 13 Jan 2004 02:57:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162582#M903021</guid>
      <dc:creator>Oliver Charni</dc:creator>
      <dc:date>2004-01-13T02:57:19Z</dc:date>
    </item>
    <item>
      <title>Re: Remove ^M character from file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162583#M903022</link>
      <description>There is a tool to remove these:&lt;BR /&gt;&lt;BR /&gt;# dos2ux uncoverted_file &amp;gt; converted_file&lt;BR /&gt;&lt;BR /&gt;There is a man page for this as well&lt;BR /&gt;&lt;BR /&gt;# man dos2ux</description>
      <pubDate>Tue, 13 Jan 2004 02:58:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162583#M903022</guid>
      <dc:creator>Michael Tully</dc:creator>
      <dc:date>2004-01-13T02:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: Remove ^M character from file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162584#M903023</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Can you send me the link from where I can download the utility ?&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Nameesh.</description>
      <pubDate>Tue, 13 Jan 2004 03:01:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162584#M903023</guid>
      <dc:creator>Nameesh</dc:creator>
      <dc:date>2004-01-13T03:01:00Z</dc:date>
    </item>
    <item>
      <title>Re: Remove ^M character from file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162585#M903024</link>
      <description>It is part of the standard OS. it should be in /usr/bin or /usr/sbin&lt;BR /&gt;&lt;BR /&gt;How else to find it:&lt;BR /&gt;&lt;BR /&gt;# whereis dos2ux&lt;BR /&gt;&lt;BR /&gt;# whence dos2ux&lt;BR /&gt;&lt;BR /&gt;# find /usr -name dos2ux -print&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 13 Jan 2004 03:05:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162585#M903024</guid>
      <dc:creator>Michael Tully</dc:creator>
      <dc:date>2004-01-13T03:05:23Z</dc:date>
    </item>
    <item>
      <title>Re: Remove ^M character from file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162586#M903025</link>
      <description>When FTP is used to send ASCII files to a UNIX box, just send these files in ascii mode then you do not have to use the dos2unix tools.&lt;BR /&gt;&lt;BR /&gt;ftp hostname&lt;BR /&gt;user password&lt;BR /&gt;ascii&lt;BR /&gt;put ascii.txt&lt;BR /&gt;quit&lt;BR /&gt;&lt;BR /&gt;Hope this helps,&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Peter Geluk</description>
      <pubDate>Tue, 13 Jan 2004 03:20:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162586#M903025</guid>
      <dc:creator>Hoefnix</dc:creator>
      <dc:date>2004-01-13T03:20:15Z</dc:date>
    </item>
    <item>
      <title>Re: Remove ^M character from file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162587#M903026</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Thnx for the input.  But, the problem with the do2ux is that we need to copy the file into another file ie.,&lt;BR /&gt;&lt;BR /&gt;dos2ux file1 &amp;gt; file2&lt;BR /&gt;&lt;BR /&gt;file2 has got all the ^M character removed.  So, need to perfomr one more step of copying file2 to file1 to have the original file with no ^M.&lt;BR /&gt;&lt;BR /&gt;Please advice script for same.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Nameesh.</description>
      <pubDate>Tue, 13 Jan 2004 03:20:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162587#M903026</guid>
      <dc:creator>Nameesh</dc:creator>
      <dc:date>2004-01-13T03:20:16Z</dc:date>
    </item>
    <item>
      <title>Re: Remove ^M character from file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162588#M903027</link>
      <description>simply:&lt;BR /&gt;&lt;BR /&gt;# dos2ux myfile &amp;gt;myfile&lt;BR /&gt;&lt;BR /&gt;will convert the original file and not save a copy.</description>
      <pubDate>Tue, 13 Jan 2004 03:28:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162588#M903027</guid>
      <dc:creator>Michael Tully</dc:creator>
      <dc:date>2004-01-13T03:28:42Z</dc:date>
    </item>
    <item>
      <title>Re: Remove ^M character from file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162589#M903028</link>
      <description>While transferring text file using ftp give ascii command to get rid of ^M character.&lt;BR /&gt;&lt;BR /&gt;sks</description>
      <pubDate>Tue, 13 Jan 2004 04:17:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162589#M903028</guid>
      <dc:creator>Sanjay Kumar Suri</dc:creator>
      <dc:date>2004-01-13T04:17:34Z</dc:date>
    </item>
    <item>
      <title>Re: Remove ^M character from file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162590#M903029</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;When I do the operation as :&lt;BR /&gt;&lt;BR /&gt;dos2ux file1 &amp;gt; file1&lt;BR /&gt;&lt;BR /&gt;Size of "file1" becomes "0" and there is nothing in file1.  &lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Nameesh.</description>
      <pubDate>Tue, 13 Jan 2004 04:58:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162590#M903029</guid>
      <dc:creator>Nameesh</dc:creator>
      <dc:date>2004-01-13T04:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: Remove ^M character from file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162591#M903030</link>
      <description>Do&lt;BR /&gt;&lt;BR /&gt;dos2ux file1 &amp;gt; file2&lt;BR /&gt;&lt;BR /&gt;sks&lt;BR /&gt;</description>
      <pubDate>Tue, 13 Jan 2004 05:36:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162591#M903030</guid>
      <dc:creator>Sanjay Kumar Suri</dc:creator>
      <dc:date>2004-01-13T05:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: Remove ^M character from file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162592#M903031</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;vi /tmp/file1&lt;BR /&gt;&lt;BR /&gt;:1,$s/&lt;CTRL&gt;+v &lt;CTRL&gt;+m//g&lt;BR /&gt;&lt;BR /&gt;This replaces all special character(&lt;CTRL&gt;+v) ^M with nothing, multiple times per line. If you would have searched this subject would have returned at least 20 results.&lt;BR /&gt;&lt;BR /&gt;Regs David&lt;/CTRL&gt;&lt;/CTRL&gt;&lt;/CTRL&gt;</description>
      <pubDate>Tue, 13 Jan 2004 05:36:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162592#M903031</guid>
      <dc:creator>David_246</dc:creator>
      <dc:date>2004-01-13T05:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: Remove ^M character from file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162593#M903032</link>
      <description>did you try the FTP session using ascii mode? Then you won't need to convert dos2ux.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Peter</description>
      <pubDate>Tue, 13 Jan 2004 05:47:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162593#M903032</guid>
      <dc:creator>Hoefnix</dc:creator>
      <dc:date>2004-01-13T05:47:29Z</dc:date>
    </item>
    <item>
      <title>Re: Remove ^M character from file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162594#M903033</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;yes, 'dos2ux file1 &amp;gt; file1' doesn't work proper.&lt;BR /&gt;Do 'dos2ux file1 &amp;gt; file2' and 'mv file2 file1' - tested ;-)&lt;BR /&gt;&lt;BR /&gt;Volkmar&lt;BR /&gt;</description>
      <pubDate>Tue, 13 Jan 2004 05:54:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162594#M903033</guid>
      <dc:creator>V. Nyga</dc:creator>
      <dc:date>2004-01-13T05:54:26Z</dc:date>
    </item>
    <item>
      <title>Re: Remove ^M character from file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162595#M903034</link>
      <description>cd &lt;DIR&gt;&lt;BR /&gt;for i in `ls`&lt;BR /&gt;do&lt;BR /&gt;dos2ux $i &amp;gt;$i.new&lt;BR /&gt;mv $i.new $i&lt;BR /&gt;done&lt;BR /&gt;&lt;/DIR&gt;</description>
      <pubDate>Tue, 13 Jan 2004 05:57:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162595#M903034</guid>
      <dc:creator>T G Manikandan</dc:creator>
      <dc:date>2004-01-13T05:57:17Z</dc:date>
    </item>
    <item>
      <title>Re: Remove ^M character from file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162596#M903035</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Peter and Sanjay are right!!!&lt;BR /&gt;Sure, it is a text file and your problem just is that you transferred it in a type different than ASCII.&lt;BR /&gt;Anyway now you can use sed command to solve your problem, here like to do it by one command:&lt;BR /&gt;&lt;BR /&gt;# sed 's/^M/ /' &lt;FILE&gt; &amp;gt; &lt;FILE.NEW&gt;&lt;BR /&gt;&lt;BR /&gt;I hope this helps you.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Ettore&lt;/FILE.NEW&gt;&lt;/FILE&gt;</description>
      <pubDate>Tue, 13 Jan 2004 06:03:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162596#M903035</guid>
      <dc:creator>Fabio Ettore</dc:creator>
      <dc:date>2004-01-13T06:03:41Z</dc:date>
    </item>
    <item>
      <title>Re: Remove ^M character from file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162597#M903036</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Michael:ouch.. the shell creates an outfile always before starting the command. So indeed the command saves nothing. ;-))&lt;BR /&gt;&lt;BR /&gt;Otherwise ascii ftp or sed or use another outfile and then rename as already posted.&lt;BR /&gt;&lt;BR /&gt;BTW: are the ^M allways at the end?&lt;BR /&gt;&lt;BR /&gt;greetings,&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Tue, 13 Jan 2004 06:18:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162597#M903036</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2004-01-13T06:18:07Z</dc:date>
    </item>
    <item>
      <title>Re: Remove ^M character from file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162598#M903037</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;you have 2 ways to get rid of this&lt;BR /&gt;1. open the file using vi&lt;BR /&gt;press &lt;ESC&gt;&lt;BR /&gt;:1,$s/ctrl+v ctrl+M//&lt;BR /&gt;:wq (to save the file)&lt;BR /&gt;&lt;BR /&gt;2. using sed&lt;BR /&gt;&lt;BR /&gt;sed 's/^M//g' &lt;FILE name=""&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/FILE&gt;&lt;/ESC&gt;</description>
      <pubDate>Tue, 13 Jan 2004 06:35:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162598#M903037</guid>
      <dc:creator>Ravi_8</dc:creator>
      <dc:date>2004-01-13T06:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: Remove ^M character from file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162599#M903038</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;Thanx for the inputs.  I wrote a script which I used to solve the problem :&lt;BR /&gt;&lt;BR /&gt;dos2ux $1 &amp;gt; tmp&lt;BR /&gt;mv tmp $1&lt;BR /&gt;&lt;BR /&gt;As suggested many of you, while ftp'g the file from the Windows box we can set "transfer type as ascii" and ^M character wouldn't be there.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Nameesh.</description>
      <pubDate>Tue, 13 Jan 2004 08:01:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162599#M903038</guid>
      <dc:creator>Nameesh</dc:creator>
      <dc:date>2004-01-13T08:01:36Z</dc:date>
    </item>
    <item>
      <title>Re: Remove ^M character from file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162600#M903039</link>
      <description>if you want to erase only ^M:&lt;BR /&gt;&lt;BR /&gt;cat &lt;FILE&gt;|tr -d \^M  &amp;gt; &lt;FILE2&gt;&lt;/FILE2&gt;&lt;/FILE&gt;</description>
      <pubDate>Wed, 14 Jan 2004 03:21:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-m-character-from-file/m-p/3162600#M903039</guid>
      <dc:creator>Marton Ferenc</dc:creator>
      <dc:date>2004-01-14T03:21:45Z</dc:date>
    </item>
  </channel>
</rss>

