adding Windows carriage returns

Patrick Rhodes Patrick.Rhodes@asu.edu
Wed, 19 Apr 2000 10:41:32 -0700


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01BFAA26.80182B50
Content-Type: text/plain;
	charset="iso-8859-1"

Shortly after sending the email, I found the solution (doesn't it always
work like that?).  Here is the script that I used:

sed 's/$/^M/g' unixfile > windowsfile

You have to hit the crtl-V sequence before you type the ctrl-M as well as
after so it puts in the actual value rather than the literal text.  But it
works great!

Patrick


-----Original Message-----
From: Victor Odhner [mailto:vodhner@primenet.com]
Sent: Wednesday, April 19, 2000 10:37 AM
To: 'PLUG'
Subject: Re: adding Windows carriage returns


On Wed, 19 Apr 2000, Patrick Rhodes wrote:
> I have text file in Linux that I need converted to Windows.  From what I
> understand, I need to add an extra carriage return or line feed at the end
> of each line to read it properly in Windows.

First, check that your system doesn't have a utod (Unix to DOS)
command.  That would just be a pipe command.   utod < foo > foo.dos

Otherwise, here's a little Perl program:

while (<>)
{
  s/$/\r/;
  print;
}

Type this into a file (call it utod.pl) and then do this:

perl utod.pl < foo > foo1

and foo1 will be a carriage-returned copy of foo.

Good luck,

Vic

------_=_NextPart_001_01BFAA26.80182B50
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2651.75">
<TITLE>RE: adding Windows carriage returns</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2>Shortly after sending the email, I found the solution =
(doesn't it always work like that?).&nbsp; Here is the script that I =
used:</FONT></P>

<P><FONT SIZE=3D2>sed 's/$/^M/g' unixfile &gt; windowsfile</FONT>
</P>

<P><FONT SIZE=3D2>You have to hit the crtl-V sequence before you type =
the ctrl-M as well as after so it puts in the actual value rather than =
the literal text.&nbsp; But it works great!</FONT></P>

<P><FONT SIZE=3D2>Patrick</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>-----Original Message-----</FONT>
<BR><FONT SIZE=3D2>From: Victor Odhner [<A =
HREF=3D"mailto:vodhner@primenet.com">mailto:vodhner@primenet.com</A>]</F=
ONT>
<BR><FONT SIZE=3D2>Sent: Wednesday, April 19, 2000 10:37 AM</FONT>
<BR><FONT SIZE=3D2>To: 'PLUG'</FONT>
<BR><FONT SIZE=3D2>Subject: Re: adding Windows carriage returns</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>On Wed, 19 Apr 2000, Patrick Rhodes wrote:</FONT>
<BR><FONT SIZE=3D2>&gt; I have text file in Linux that I need converted =
to Windows.&nbsp; From what I</FONT>
<BR><FONT SIZE=3D2>&gt; understand, I need to add an extra carriage =
return or line feed at the end</FONT>
<BR><FONT SIZE=3D2>&gt; of each line to read it properly in =
Windows.</FONT>
</P>

<P><FONT SIZE=3D2>First, check that your system doesn't have a utod =
(Unix to DOS)</FONT>
<BR><FONT SIZE=3D2>command.&nbsp; That would just be a pipe =
command.&nbsp;&nbsp; utod &lt; foo &gt; foo.dos</FONT>
</P>

<P><FONT SIZE=3D2>Otherwise, here's a little Perl program:</FONT>
</P>

<P><FONT SIZE=3D2>while (&lt;&gt;)</FONT>
<BR><FONT SIZE=3D2>{</FONT>
<BR><FONT SIZE=3D2>&nbsp; s/$/\r/;</FONT>
<BR><FONT SIZE=3D2>&nbsp; print;</FONT>
<BR><FONT SIZE=3D2>}</FONT>
</P>

<P><FONT SIZE=3D2>Type this into a file (call it utod.pl) and then do =
this:</FONT>
</P>

<P><FONT SIZE=3D2>perl utod.pl &lt; foo &gt; foo1</FONT>
</P>

<P><FONT SIZE=3D2>and foo1 will be a carriage-returned copy of =
foo.</FONT>
</P>

<P><FONT SIZE=3D2>Good luck,</FONT>
</P>

<P><FONT SIZE=3D2>Vic</FONT>
</P>

</BODY>
</HTML>
------_=_NextPart_001_01BFAA26.80182B50--