LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-18-2013, 07:35 AM   #1
pradeepdee6
Member
 
Registered: Jul 2012
Posts: 30

Rep: Reputation: Disabled
How to eliminate the control M char when transfering (FTP/sftp) from windows to Unix


Hi Everyone,

Thanks for your time.

We need to transfer files from Windows server to Unix server. What we see is the transfered file will be having control M characters as the file transfered is not in Unix format.

How to take care of this file format error.

Im using AIX version of Unix.

Please Help!!

Thanks in Advance!!!
 
Old 02-18-2013, 07:50 AM   #2
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
Blog Entries: 2

Rep: Reputation: 244Reputation: 244Reputation: 244
Have you got the dos2unix program?

Otherwise you could use some form of editing in sed/ex/perl or whatever suits you to change the line endings.
 
1 members found this post helpful.
Old 02-18-2013, 08:23 AM   #3
allend
Senior Member
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 4,552

Rep: Reputation: 1433Reputation: 1433Reputation: 1433Reputation: 1433Reputation: 1433Reputation: 1433Reputation: 1433Reputation: 1433Reputation: 1433Reputation: 1433
This seems to cover the bases. http://www.cyberciti.biz/faq/howto-u...x-text-format/
 
1 members found this post helpful.
Old 02-18-2013, 08:09 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,362

Rep: Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377
As above, there are various tools to do the conversion after the upload. I normally go that route.
Theoretically, if you specify ASCII mode to be used, it should convert it for you, as opposed to binary mode, where it doesn't
Like I said, I prefer to not trust ftp, but to do it myself.
YMMV
 
Old 02-18-2013, 09:31 PM   #5
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
Blog Entries: 2

Rep: Reputation: 244Reputation: 244Reputation: 244
vsftpd.conf says

# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
 
Old 02-18-2013, 09:35 PM   #6
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,482

Rep: Reputation: 2089Reputation: 2089Reputation: 2089Reputation: 2089Reputation: 2089Reputation: 2089Reputation: 2089Reputation: 2089Reputation: 2089Reputation: 2089Reputation: 2089
This is a problem you'll have to face whenever you transfer any ASCII files from Win to Lin or vice versa, via ANY transfer method. ftp, scp, sftp, samba, email, or just sticking a file on a USB stick and moving it over. If you regularly transfer ASCII files between Win and Lin, in either direction, you need to become very good friends with dos2unix and unix2dos.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to count and eliminate a repeating char (-) leading up to a needed sequence tgarvin Linux - Software 4 04-26-2011 02:18 PM
Passwordless SFTP between Unix box and Windows dev_d Linux - Networking 3 03-31-2010 07:08 AM
transfering control to a terminal? shamgar03 Linux - General 2 08-10-2006 11:29 AM
autmatic ftp: from unix to windows spyghost Programming 11 08-26-2003 11:57 PM
autmatic ftp: from unix to windows spyghost Solaris / OpenSolaris 3 08-25-2003 06:37 PM


All times are GMT -5. The time now is 02:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration