Operating System - HP-UX
1835228 Members
7687 Online
110078 Solutions
New Discussion

Ftp transfer corrupts script by adding ctrl-m characters to end of every line.

 
SOLVED
Go to solution
Michael Hemmingsen
Occasional Advisor

Ftp transfer corrupts script by adding ctrl-m characters to end of every line.

I have downloadet a script from HP Resource Center (a patch PHCO_17318) to my Win2000 pc.

The script was then copied to a HP9000 K859 server running HP-UX B11.00 A, via ftp 'put' command in binery mode.

However the script cannot run, because a ^M (ctrl-M) was added to the end of each line in the file. This shows in the vi editor.

How can the adding of the ^M (ctrl-M) characters be avoidet?

Your help/hints is much appreciated.
Why take your-/myself so seriously?
2 REPLIES 2
Dan Hetzel
Honored Contributor

Re: Ftp transfer corrupts script by adding ctrl-m characters to end of every line.

Hi,

This happened because you didn't set your ftp in 'binary' mode.

On a PC, all lines end with the pair while you only have linefeed on unix.

You may use the 'dos2unix' command to convert your file or, with vi:
:1,$s///

Best regards,

Dan
Everybody knows at least one thing worth sharing -- mailto:dan.hetzel@wildcroft.com
Dan Hetzel
Honored Contributor
Solution

Re: Ftp transfer corrupts script by adding ctrl-m characters to end of every line.

Correction,

If the file was saved on a PC, you should use the 'ASCII' mode as this will convert CR-LF pairs to LF.

Dan
Everybody knows at least one thing worth sharing -- mailto:dan.hetzel@wildcroft.com