Mailing List Archive

Support open source code!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tlug: search in mailing list archive -- dos2unix





On 13 Feb 2000, Mike Fabian wrote:

>  Ulrike Schmidt <798a5047@example.com> writes:
>  
>  [...]
>  
>  > In the meantime: I was looking for how to strip what turns up in emacs as
>  > "^M" at the end of the lines in files downloaded in apparently not the
>  > correct way. I had the same question ages ago and it is somewhere in the
>  > archives ... Don't bother, I'll download the files again. Just for the
>  > future...
>  
>  Go to the top of the buffer in Emacs and then type:
>  
>      M-x replace-string RET
>      C-q C-m RET
>      RET
>  


While this will work, it may be useful to know that what you have got is
a DOS text file probably downloaded by ftp in *binary* mode, or served
by some http server with wrong content type info.

There are two convenient utilities 'dos2unix' and 'unix2dos' that
convert such text files from DOS format to Unix format and back. At the
shell prompt type

dos2unix foo.txt

to convert and replace foo.txt, and
               ^^^^^^^ 
unix2dos foo.txt 

to get back all those ^M 's.

It has one or two useful command line options such as --keepdate. See
the man page. 

Selva


--------------------------------------------------------------------
Next Nomikai Meeting: February 18 (Fri) 19:00 Tengu TokyoEkiMae
Next Technical Meeting:  March 11 (Sat) 13:00 Temple University Japan
* Topic: TBD
--------------------------------------------------------------------
more info: http://www.tlug.gr.jp        Sponsor: Global Online Japan


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links