This is a discussion on FTP PROBLEM with ^M within the AIX Operating System forums, part of the Unix Operating Systems category; --> When I ftp from my pc to a unix box, my file fransfers, but each line contains a ^M ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| In article <3fdde604_1@news.athenanews.com>, "Pete Rau" <Pete_Rau@beamspeed.net> wrote: > When I ftp from my pc to a unix box, my file fransfers, but each line > contains a ^M at the end of the line. Does anyone know how to remove the > character. > > Thanks. > > A quick and dirty way is to use tr: tr '\r' '\n' <oldfile >newfile |
| |||
| Pete Rau wrote: > When I ftp from my pc to a unix box, my file fransfers, but each line > contains a ^M at the end of the line. Does anyone know how to remove the > character. Use the "ascii" subcommand in ftp to set your file mode to ASCII. Or otherwise force the mode to ASCII instead of binary. ASCII mode will cause the two machines to do what's necessary for <CR><LF> pairs when going from a windoze box to Unix. Once there, the tr command is helpful (as suggested in another reply). -- Gary R. Hook / AIX PartnerWorld for Developers / These opinions are MINE __________________________________________________ ______________________ |
| |||
| "Pete Rau" <Pete_Rau@beamspeed.net> wrote in message news:<3fdde604_1@news.athenanews.com>... > When I ftp from my pc to a unix box, my file fransfers, but each line > contains a ^M at the end of the line. Does anyone know how to remove the > character. > > Thanks. vi the file and do :1,$s/<ctrl v><ctrl m>//g then do :wq! I think you also need to ftp the file using ascii mode, butI can't confirm this. Steve |
| ||||
| Pete Rau wrote: > When I ftp from my pc to a unix box, my file fransfers, but each line > contains a ^M at the end of the line. Does anyone know how to remove the > character. > > Thanks. > > After the fact, you can use vi interactively with :%s/.$// (as long as there's carriage return after the last line.. you may want to check that.. otherwise you may drop the last character of the file) Or use perl: perl -pi -e 's/.$//' filename Make sure you are in ascii mode when you transfer text files... if you are transferring a mix of files... then you can use the perl command above to fix the text ones. |