Removing ^M characters from a DOS text file

Removing ^M characters from a DOS text file

Post by Joh » Fri, 11 Nov 1994 09:38:33



        How do I get rid of the ^M characters from a text file
        that appear when using Emacs?

                        Thanks,

 
 
 

Removing ^M characters from a DOS text file

Post by Lenny Jaco » Fri, 11 Nov 1994 15:34:00



Quote:>    How do I get rid of the ^M characters from a text file
>    that appear when using Emacs?
>                    Thanks,

tr -d '\015' < infile > outfile
--
+----------------------------------------------------------------------+

+----------------------------------------------------------------------+

 
 
 

Removing ^M characters from a DOS text file

Post by Pierre Gaumo » Fri, 11 Nov 1994 23:11:37



>    How do I get rid of the ^M characters from a text file
>    that appear when using Emacs?

I assume you are on Unix. Try:

   tr -d '\015' <in >out

Quote:>                    Thanks,

 
 
 

Removing ^M characters from a DOS text file

Post by Jose Miguel Figueroa-O'Farri » Sun, 13 Nov 1994 07:05:00



Quote:

>> How do I get rid of the ^M characters from a text file
>> that appear when using Emacs?

Pierre> I assume you are on Unix. Try:

Pierre>    tr -d '\015' <in >out

Yes, but if you are already in Emacs, why not simply do the following:

         M-x replace-string C-m C-q C-m C-m

--jmf

--
+----------------------------------+----------------------------------+
| Jose M. Figueroa-O'Farrill       | Vox: +44.171.975-5055            |
| Department of Physics (Rm. 227)  | Fax: +44.181.981-7465            |

| Mile End Road, London E1 4NS, UK |                                  |
|                                 or                                  |
|  check out http://stringswww.ph.qmw.ac.uk/~jmf/jmf.html on the WWW. |
+----------------------------------+----------------------------------+

 
 
 

Removing ^M characters from a DOS text file

Post by Jose Miguel Figueroa-O'Farri » Sun, 13 Nov 1994 10:10:11



Quote:

>>> How do I get rid of the ^M characters from a text file
>>> that appear when using Emacs?

Pierre> I assume you are on Unix. Try:

Pierre> tr -d '\015' <in >out

jmf> Yes, but if you are already in Emacs, why not simply do the following:

jmf>          M-x replace-string C-m C-q C-m C-m

Sorry, I left out a C-m!

Try this:

               M-x replace-string C-m C-q C-m C-m C-m

Sorry about the typo above...

--jmf
--
+----------------------------------+----------------------------------+
| Jose M. Figueroa-O'Farrill       | Vox: +44.171.975-5055            |
| Department of Physics (Rm. 227)  | Fax: +44.181.981-7465            |

| Mile End Road, London E1 4NS, UK |                                  |
|                                 or                                  |
|  check out http://stringswww.ph.qmw.ac.uk/~jmf/jmf.html on the WWW. |
+----------------------------------+----------------------------------+

 
 
 

Removing ^M characters from a DOS text file

Post by Robert J. Shm » Sat, 12 Nov 1994 01:31:21


:>   How do I get rid of the ^M characters from a text file
:>   that appear when using Emacs?

query-replace-string ^M with ''

where '' is nothing, just hit enter.. that should kill them
if you wanted to shell out for a second, you could also:

sed s/^M// < input_file > output_file
--
----------------------+--------------------------------------------------

----------------------+ of Atogs. I will still accept them at NO CHARGE to
Brian Cully           | you! Email me for information about my home for

 
 
 

Removing ^M characters from a DOS text file

Post by Mr Kevin Yeu » Mon, 21 Nov 1994 03:37:09



: :> How do I get rid of the ^M characters from a text file
: :> that appear when using Emacs?

: query-replace-string ^M with ''

: where '' is nothing, just hit enter.. that should kill them
: if you wanted to shell out for a second, you could also:

: sed s/^M// < input_file > output_file

How to do the reverse?  I've got a Unix file and I open it in Word for
Windows 2.0c and found that there're carriage returns at the end of each
line.  How to remove the CRs and re-paginate the text?

--
Kevin Yeung



pager: (852)1128-903 a/c 8004

 
 
 

Removing ^M characters from a DOS text file

Post by Graham Broadbrid » Mon, 21 Nov 1994 18:11:16


:       How do I get rid of the ^M characters from a text file
:       that appear when using Emacs?

tr -d -c '\r' < infile > outfile

--
+----------------------------------------------------------------------------+


  Australia                 FidoNet 3:711/907
+----------------------------------------------------------------------------+

 
 
 

Removing ^M characters from a DOS text file

Post by Pierre Gaumo » Wed, 23 Nov 1994 00:30:37




>:   How do I get rid of the ^M characters from a text file
>:   that appear when using Emacs?

>tr -d -c '\r' < infile > outfile

       --
This will delete anything except ^M. Just `-d' option is needed.

>--
>+----------------------------------------------------------------------------+


>  Australia                 FidoNet 3:711/907
>+----------------------------------------------------------------------------+

 
 
 

Removing ^M characters from a DOS text file

Post by Curtis Eva » Fri, 25 Nov 1994 03:43:41




>:   How do I get rid of the ^M characters from a text file
>:   that appear when using Emacs?

>tr -d -c '\r' < infile > outfile

In UNIX V.4, I use col(1)

cat infile |col -b > outfile

Do be aware that this strips ALL control characters!

--

 
 
 

Removing ^M characters from a DOS text file

Post by Yuliang » Sat, 26 Nov 1994 09:16:06



>:   How do I get rid of the ^M characters from a text file
>:   that appear when using Emacs?

M-x replace-regexp Enter
Ctrl-q then Ctrl-M Enter
Enter

--

 
 
 

Removing ^M characters from a DOS text file

Post by William Drieli » Tue, 29 Nov 1994 07:36:07



: >
: >:         How do I get rid of the ^M characters from a text file
: >:         that appear when using Emacs?
: >
: >tr -d -c '\r' < infile > outfile
: >

: In UNIX V.4, I use col(1)

: cat infile |col -b > outfile

: Do be aware that this strips ALL control characters!

: --

--

I found some source code that I compiled on my system to convert from
pc text to unix text and also the other way around
the file was
        pc2unix.zip
and should show up with a search at an archie site or another.
it includes pc2unix and unix2pc code.
I compiled it on my system and it works fine so far, I don't think I've
tried any files with other control characters besides ^M, but it's worked
fine for everything else.

After compiling the code and doing chmod on it, you use it like a filter

pc2unix < text.dos > text.unix
or
cat text.unix | unix2pc > text.dos

i.e. just send text to it and redirect its output to a file somewhere.

I don't do programming yet so I was plenty satisfied with getting it to
work using the instructions that came with it.

*************************************************************

]M- XEU?_ ?+_? WV?v ?F |tZ?F &?< tQj & ??|_ Ph? ?F PV< ?|_
PG RP?|_ P ?|_ P__ a- ?FnW+ ?Fn_ joj j j j j j j 5 ++^_MM?_

NO CARRIER