ftp to Unix

G

Guest

I am transferring data from a s/s to a Unix server using the 'save in'
feature Add/Modify FTP Location, but each line has ^M at the end of it. This
is normally caused by the transfer protocol. Is this set in Microsoft or the
Unix server?
 
G

Guest

The ^M in dicates there is both a Carriage Retiurn and line feed at the end
of a line. Windows puts both the line feed and CR in the file while Unix
only has CR. On most UNIX machines there are two commands unix2dos and
dos2unix. Running dos2unix filename > newfilename will fix the problem.
 
G

Guest

With FTP diod you set it for Ascii or binary. try using Ascii transfer, this
will probably remove the Linefeed.

Other methods are to use VI editor and removve last character in each row.

vi filename

type colon :)) to get in command mode. Then type the following

1,$s/.$//

1,$ is the address for doing every line in the file. $ is ast line in the
file

s/.$// the $ in this case is end of line. .$ is the last charactter on the
line. s is the substitute command. Replaces last character on the line with
nothing.


You can also make a script using the SED editor. I don't remmber this sytax.
 
G

Guest

Hi Joel
Thanks for response. Is this a command that would have to be applied to
every file transferred or can it be incorporated into a general setting. I
will have multiple users saving many files so ideally it needs to be a
setting. What is interesting is other clients of mine can do exactly this,
i.e. save from Excel direct to the Unix server and the file remains true i.e.
no ^M to be seen anywhere. What we cannot work out is what is different
between the 2 organisations i.e. why it works there but fails here.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top