Settings

The page will reload to apply your changes.
Theme

ASCII Art Font

ASCII Art Menu

Original Usenet thread from alt.ascii-art, started 11 Jan 1995.
 _   _                     _        _             _     _           
| | | |___  ___ _ __   ___| |_     / \   _ __ ___| |__ (_)_   _____ 
| | | / __|/ _ \ '_ \ / _ \ __|   / _ \ | '__/ __| '_ \| \ \ / / _ \
| |_| \__ \  __/ | | |  __/ |_   / ___ \| | | (__| | | | |\ V /  __/
 \___/|___/\___|_| |_|\___|\__| /_/   \_\_|  \___|_| |_|_| \_/ \___|
Talk: Uploading and Trailing M's

Talk: Uploading and Trailing M's

alt.ascii-art · 6 messages · 11 Jan 1995 - 17 Jan 1995
Daniel Au <dca...@casbah.acns.nwu.edu> ASCII art 11 Jan 1995 07:38 · permalink · report
Does anyone else have problems with such as the one below...I assume that the
person uploaded a file and got all the trailing M's, which I know occurs with
any text file because it happens to me too.

Andy Rosulek <una...@sfa.ope.ed.gov> wrote:
>
>How about these?
>
>   \~\~~~~~~~~~\~\   |
>    \|__________\|   |        ____________
>    /           /|   |      /~          /~|
>   /           / |   or    |           | /|
>  |~~~~~U~~~~~|  |   |     |~~~~~U~~~~~|` |
>  |           | /    |     |           | /
>  |___________|/     |     |___________|/
>

Is there any way to remove the trailing ^M's instead of doing it by hand,
which is what I'm doing now?  Sometimes, if the file is long, it can be
_tremendously_ frustrating.  Any help would be appreciated.

Daniel
--
	      _                                             _
	   __| |___  _ _ __ __   _ ____ __ _ __ __   ___ __| |__ __
	  / o  /  c/ o` |  U  |@| '  \ V  V |  U  | /  e/ o  |  U  |
	  \__n_\___\__n_|\__n_| |__|_|\_/\_/ \__n_|o\___\__n_|\__n_|
     850 N. Lake Shore Drive #1438 / Chicago, IL 60611 / (312) 482-0840
		    Northwestern University Medical School
			       Ward Box #007

Daniel Au speaking:
> Does anyone else have problems with such as the one below...I assume
> that the person uploaded a file and got all the trailing M's, which I
> know occurs with any text file because it happens to me too.

It's a consequence of an old argument about text file format.  MS-DOS
machines end lines with character 13 (CR) then character 10 (LF); UNIX
ends lines with only the LF, and other operating systems take sides.

The workstation I'm on has a program, dos2unix, that strips the
extraneous ^M's out of a text file, but if you don't have something of
that name (I think it's a Sun thing) you can use the command

  sed 's/[^ -~]$//' < filename > newfilename

(in UNIX) to do the same thing (translate DOS text from {filename} into
{newfilename}).  It would also filter out other control codes,
including such nice things as HT, BEL and ESC, but only if they
occurred at the end of a line, which they wouldn't be likely to, so
it's pretty safe.  In any case, it's the best I can do.

Peter

In article <3f01ta$im...@gagme.wwa.com>,
Daniel Au <dca...@casbah.acns.nwu.edu> wrote:
>
>Does anyone else have problems with such as the one below...I assume that the
>person uploaded a file and got all the trailing M's, which I know occurs with
>any text file because it happens to me too.
>
>Is there any way to remove the trailing ^M's instead of doing it by hand,
>which is what I'm doing now?  Sometimes, if the file is long, it can be
>_tremendously_ frustrating.  Any help would be appreciated.
>

Daniel,

I think that this is caused by a DOS<->UNIX translation.  If you do your
file transfers as text instead of binary you shouldn't have the problem.
If you have files that already contain the ^M's try using the unix2dos
or dos2unix commands to remove them.  I don't remember which you'll want
to use in this particular case.

Hope this is right and helps,
-Brett

Brad <syb...@aber.ac.uk> ASCII art 12 Jan 1995 00:04 · permalink · report
	You can do this by creating a file containing the following line:

tr -d '^M' <file1 >file2

where ^M is actually a ctrl-M (you can create these in vi by hitting ^V
followed by ^M), file1 is the original filename, and file2 is the file to
be created. Then type, from UNIX, "source <filename--this one is the file
you created in the first place>", and file2 will be the same as file but
without the ^M's.

P.S. Sorry for the confusing instructions. My excuse: I'm tired. ;)

 ___  _                     _a' /(   <.  Simon Bradley, Knight Protector!
/ __><_>._ _ _  ___ ._ _ ~~ _}\ \(  _  ) E-mail: syb...@aber.ac.uk
\__ \| || ' ' |/ . \| ' |      \(._(.)'  Finger: syb...@osfb.aber.ac.uk
<___/|_||_|_|_|\___/|_|_|     ._>. _>.   WWW: http://www.aber.ac.uk/~syb3/

On 11 Jan 1995, Daniel Au wrote:

> Is there any way to remove the trailing ^M's instead of doing it by hand,
> which is what I'm doing now?  Sometimes, if the file is long, it can be
> _tremendously_ frustrating.  Any help would be appreciated.

you can run the file thru the filter "col -b".
in vi, you can %s:.$::

r

Brad (syb...@aber.ac.uk) wrote:

> 	You can do this by creating a file containing the following line:

> tr -d '^M' <file1 >file2

> where ^M is actually a ctrl-M (you can create these in vi by hitting ^V
> followed by ^M), file1 is the original filename, and file2 is the file to
> be created. Then type, from UNIX, "source <filename--this one is the file
> you created in the first place>", and file2 will be the same as file but
> without the ^M's.


tr -d '\r' <file1 >file2

will do the same thing.  '\r' is the escape code for ^M, and doesnt
require any special way of entering it into an editor apart from just
typing it.


--
Reagan Blundell             |        "I'm lying on my back now
nod...@desire.apana.org.au   |         the stars look all too near
APANA Brisbane Regional     |         flowers on the razor wire
Management Committee        |         I know you're here" - Andrew Eldritch

About this thread. These messages were posted publicly to the newsgroup alt.ascii-art in 1995 and are mirrored here unchanged as part of the Historic Archives – only email addresses are masked. The artwork and text belong to their original authors: if you copy a piece, keep the artist's initials or signature intact and credit them where you can. Are you one of the authors? Contact us to get your posts attributed, connected to your artist profile, or removed.

Report this message

Help us keep the archive clean and accurate. Reports are reviewed by a person – nothing is changed automatically.

Help classify this post