Operating System - HP-UX
1825693 Members
3265 Online
109686 Solutions
New Discussion

Re: File transfer from windows to hpux adding ^M at the end of all lines in all scripts from a directory

 
SOLVED
Go to solution
JASH_2
Trusted Contributor

File transfer from windows to hpux adding ^M at the end of all lines in all scripts from a directory

Chaps,

I am trying to transfer a directory from my PC to my hpux server, but all the scripts in there have the ^M at the end of each line. There are a lot of scripts/control files and I do not want to edit each one and remove them. Is there a special way to ftp them without the new lines showing as ^M, or is there something else I can do?

The server is an rp3440 with hp-ux 11.11.

Many Thanks.

JASH
If I can, I will!
8 REPLIES 8
melvyn burnard
Honored Contributor

Re: File transfer from windows to hpux adding ^M at the end of all lines in all scripts from a directory

how are you transfering them?
Using ftp? Then make sure you have set the transfer mode to binary.
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
JASH_2
Trusted Contributor

Re: File transfer from windows to hpux adding ^M at the end of all lines in all scripts from a directory

I used ftp in binary, 1st time with hummingbird, second from cmd line. Both type I.

Cheers.
If I can, I will!
Don Wilt
Advisor
Solution

Re: File transfer from windows to hpux adding ^M at the end of all lines in all scripts from a directory

The file is in ASCII format, use the 'dos2ux' command to remove the character.
dos2ux file > newfile
Ninad_1
Honored Contributor

Re: File transfer from windows to hpux adding ^M at the end of all lines in all scripts from a directory

I think there is some confusion with the suggestion - If the files you want to tranfser contain text then you should use ascii format while ftping and not binary.
When you use ascii format while copying from dos to unix, the ^M [ which is the character for line-feed ] is correctly interpreted as line-feed and not as charater ^M. whereas if you sue binary its treated as a charater ^M.

So please set mode as ascii.

Regards,
Ninad
Jakes Louw
Trusted Contributor

Re: File transfer from windows to hpux adding ^M at the end of all lines in all scripts from a directory

Ninad is correct: binary mode does not convert the file using any interpreted format-effectors, and should be used on files that should NOT be mangled or changed.
ASCII format will convert CarriageReturn and LineFeed/NewLine characters from UNIX to DOS modes.
Trying is the first step to failure - Homer Simpson
JASH_2
Trusted Contributor

Re: File transfer from windows to hpux adding ^M at the end of all lines in all scripts from a directory

Ok, brain now in gear! Realise error of my ways. I am sooo used to having to transfer files in binary that I automatically change the settings to binary. Now done differently, so the appropriate files are transferred properly.

Thanks to you all.
JASH
If I can, I will!
JASH_2
Trusted Contributor

Re: File transfer from windows to hpux adding ^M at the end of all lines in all scripts from a directory

Will check status of file next time-honest!
If I can, I will!
melvyn burnard
Honored Contributor

Re: File transfer from windows to hpux adding ^M at the end of all lines in all scripts from a directory

Yes, I also am so used to using binary transfer, so my answer was bad.
Apologies
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!