[Sunhelp] Copy text files from Unix to NT using PC Netlink?
Adams, Christopher
CAdams at Starbase.com
Tue Oct 3 09:34:12 CDT 2000
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_01C02D46.FFE7FF2E
Content-Type: text/plain;
charset="iso-8859-1"
You can use the utility " dos2unix " to remove the ^M
Just type: dos2unix <filename1> <filename2> [RETURN]
example: *dirtyfile has a lot of ^M's in it and you want to remove them
prompt> dos2unix dirtyfile dirtyfile [RETURN]
Just type the utility name "dos2unix" and the file which you want to clean
twice after the utility name, then press enter.
This will clean dirtyfile and give it the same name in the form of a new
file.
You can add this to a script if you like to make it more batch like.
Good Luck!
-----Original Message-----
From: Dennis L. Lund [mailto:dllund at hermes.nextel.com]
Sent: Monday, October 02, 2000 10:42 AM
To: sunhelp at sunhelp.org
Subject: Re: [Sunhelp] Copy text files from Unix to NT using PC Netlink?
If it is the ^M that you are trying to remove, I use this script to do it:
#!/usr/bin/ksh
#
# This script will remover the ^M from the end of each
# line in a file.
#
# USAGE: rm_M_char <filename>
#
if [ -f $1 ]
then
tr -d '\15' < $1 >newname
mv newname $1
fi
Hope this helps.
Dennis Lund
_______________________________________________
SunHELP maillist - SunHELP at sunhelp.org
http://www.sunhelp.org/mailman/listinfo/sunhelp
------_=_NextPart_001_01C02D46.FFE7FF2E
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.2448.0">
<TITLE>RE: [Sunhelp] Copy text files from Unix to NT using PC =
Netlink?</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=3D2>You can use the utility " dos2unix " =
to remove the ^M</FONT>
</P>
<P><FONT SIZE=3D2>Just type: dos2unix <filename1> =
<filename2> [RETURN]</FONT>
</P>
<P><FONT SIZE=3D2>example: *dirtyfile has a lot of ^M's in it and you =
want to remove them</FONT>
</P>
<P><FONT SIZE=3D2>prompt> dos2unix dirtyfile dirtyfile =
[RETURN]</FONT>
</P>
<BR>
<P><FONT SIZE=3D2>Just type the utility name "dos2unix" and =
the file which you want to clean twice after the utility name, then =
press enter.</FONT></P>
<P><FONT SIZE=3D2>This will clean dirtyfile and give it the same name =
in the form of a new file.</FONT>
<BR><FONT SIZE=3D2>You can add this to a script if you like to make it =
more batch like.</FONT>
</P>
<P><FONT SIZE=3D2>Good Luck!</FONT>
</P>
<P><FONT SIZE=3D2>-----Original Message-----</FONT>
<BR><FONT SIZE=3D2>From: Dennis L. Lund [<A =
HREF=3D"mailto:dllund at hermes.nextel.com">mailto:dllund at hermes.nextel.com=
</A>]</FONT>
<BR><FONT SIZE=3D2>Sent: Monday, October 02, 2000 10:42 AM</FONT>
<BR><FONT SIZE=3D2>To: sunhelp at sunhelp.org</FONT>
<BR><FONT SIZE=3D2>Subject: Re: [Sunhelp] Copy text files from Unix to =
NT using PC Netlink?</FONT>
</P>
<BR>
<P><FONT SIZE=3D2>If it is the ^M that you are trying to remove, I use =
this script to do it:</FONT>
</P>
<P><FONT SIZE=3D2>#!/usr/bin/ksh</FONT>
<BR><FONT SIZE=3D2>#</FONT>
<BR><FONT SIZE=3D2># This script will remover the ^M from the end of =
each</FONT>
<BR><FONT SIZE=3D2># line in a file.</FONT>
<BR><FONT SIZE=3D2>#</FONT>
<BR><FONT SIZE=3D2># USAGE: rm_M_char <filename></FONT>
<BR><FONT SIZE=3D2>#</FONT>
</P>
<P><FONT SIZE=3D2>if [ -f $1 ]</FONT>
<BR><FONT SIZE=3D2>then</FONT>
<BR><FONT SIZE=3D2> tr -d '\15' < $1 >newname</FONT>
<BR><FONT SIZE=3D2> mv newname $1</FONT>
<BR><FONT SIZE=3D2>fi</FONT>
</P>
<P><FONT SIZE=3D2>Hope this helps.</FONT>
</P>
<P><FONT SIZE=3D2>Dennis Lund</FONT>
<BR><FONT =
SIZE=3D2>_______________________________________________</FONT>
<BR><FONT SIZE=3D2>SunHELP maillist - =
SunHELP at sunhelp.org</FONT>
<BR><FONT SIZE=3D2><A =
HREF=3D"http://www.sunhelp.org/mailman/listinfo/sunhelp" =
TARGET=3D"_blank">http://www.sunhelp.org/mailman/listinfo/sunhelp</A></F=
ONT>
</P>
</BODY>
</HTML>
------_=_NextPart_001_01C02D46.FFE7FF2E--
More information about the SunHELP
mailing list