CRLF during SFTP transfer is appearing only in one server


 
Thread Tools Search this Thread
Operating Systems AIX CRLF during SFTP transfer is appearing only in one server
# 1  
Old 10-31-2008
CRLF during SFTP transfer is appearing only in one server

Hello.

I have got 3 unix boxes A B C. Box A is being used to prepare some reports. After the reports generation, Box A sftp the reports to Box B and Box C. When I look at the report in Box B and Box C. The reports are different. In Box B, I see using od -x command there is CRLF (\r\n) at the end of each line. Whereas in Box C, the hexa version of report displays only LF (\n).

Do you know what might the reason of having two different behaviours, when the boxes are of same setup and the transfer mode is same. Is there still could be some setup related to SSH or SFTP, which affects the way we get CRLF?

THANKS A LOT for your reply.
# 2  
Old 10-31-2008
Not that I know of. Maybe as a workaround until you find a solution, remove the LF on that one box with
Code:
tr -d '\015' < file > file.new

# 3  
Old 10-31-2008
The output in Box B is correct i.e. I want to have CRLF after transfer visible in the report. How can I make sure to do this during transfer or somewhere in the setup so that I could bring consistency in both the servers and always get CRLF in the report?
# 4  
Old 11-01-2008
Please advice your feedback. Also, could you tell me the similar command in AIX for 'ux2dos' we have in HP-UX?
# 5  
Old 11-01-2008
ux2dos with awk

Quote:
Originally Posted by panchpan
Please advice your feedback. Also, could you tell me the similar command in AIX for 'ux2dos' we have in HP-UX?
An alternative with awk:

Code:
awk '{printf("%s\015\n", $0)}' file > newfile

Regards
# 6  
Old 11-01-2008
The problem is - obviously - a DOS/Unix conversion taking place in the one case but not in the other. There might be several places to look for a remedy (i suppose you have already checked the transfer mode itself), here is one:

Some ftp clients have a "auto" option where they try to guess if to transfer in binary or ASCII mode. Maybe the heuristics on one box lead to different results than on the other. Maybe they are based on /etc/magic and this file is different.

It might help to enforce binary - or, depending on the desired result, ASCII - mode explicitly to get consistent results.

I hope this helps.

bakunin
# 7  
Old 11-02-2008
Hello
The method of transferring the file is same in both the servers. But still I am not able to notice the different settings in both the target servers.

Please suggest any tips where could I look for the difference in server configurations. /etc/magic is identical in both of them.

Thank you
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Need some help regarding file transfer between server (sftp/scp)

Hi All, Need some help regarding file transfer between server. Suppose we have system-A and system-B. To transfer file from system-A to system-B we usually share the public keys of system-A to system-B and do scp/sftp to transfer a file. Is it possible that public key of system-B can be... (3 Replies)
Discussion started by: abhi_123
3 Replies

2. Shell Programming and Scripting

Junk character appearing after downloading the file from windows server

Hello, Im downloading the file from windows server through FTP, the downloaded file is containing some junk character at very start of the file as below and causing my whole script is to fail, how to download without junk or how to remove these before processing it? ▒▒"nmdbfnmdsfsdf" ... (19 Replies)
Discussion started by: Riverstone
19 Replies

3. Shell Programming and Scripting

File transfer using SFTP

Hi, I want to a transfer file from remote machine to a local machine using SFTP where both my local and remote machines are Ubuntu machines.So i wanted to write a unix bash script which uses SFTP command to transfer the file from remote to local machine. My remote server is 178.28.30.106. ... (14 Replies)
Discussion started by: shree11
14 Replies

4. Shell Programming and Scripting

Sftp : not able to print the echo statements after the sftp transfer

I had the below sftp script working perfectly but the problem is I am not able to send the echo statements . #!/bin/sh echo "Starting to sftp..." sftp admin@myip << END_SCRIPT cd /remotepath/ lcd /localpath/ mget myfiles*.csv bye END_SCRIPT echo "Sftp successfully." echo echo... (11 Replies)
Discussion started by: scriptscript
11 Replies

5. IP Networking

How to transfer files from UNIX server to windows machine or vice versa using ftp or sftp commands?

hi, i want to write a shell script code which transfers files from a directory in unix server to a directory in a windows machine.. can any1 give me a sample code which uses ftp or sftp command.. thanks very much, (3 Replies)
Discussion started by: Little
3 Replies

6. Shell Programming and Scripting

Transfer files from linux server to windows using secure ftp (sftp)

HI, I have to transfer files from linux server to windows using secure ftp (sftp) .Kindly help me out. (3 Replies)
Discussion started by: manushi88
3 Replies

7. UNIX for Dummies Questions & Answers

SFTP transfer does not complete

I am able to connect to a site and start a file transfer via SFTP, but when the file reaches "100%" -- the file does not complete and "stop". The 100% transfer status does not change (obviously), but the timer for SFTP keeps going and will not complete. This also happens when I try to get a file.... (2 Replies)
Discussion started by: loganban
2 Replies

8. Shell Programming and Scripting

Using SFTP and FTP to transfer data from One Remote Server To Another

HI I need to write a script in 415univ server which should go to 534unix server and move the files from there to windows server. I am not able to get it bcoz sftp prompt is not allowing ftp command. Can some one plz help me Thanks in advance (3 Replies)
Discussion started by: himakiran9
3 Replies

9. Shell Programming and Scripting

SFTP to transfer files from one server to another

Hello, i have to write a script to perform sftp from the remote server to another server. the files which are at the remote location are huge data log files which should be transfered to my server in a particular folder. could you please provide me the general code (simple )... (1 Reply)
Discussion started by: urfrnddpk
1 Replies

10. Shell Programming and Scripting

sftp file transfer

hi i am trying to login to remote server using SFTP Protocol and trying to upload a file butit is asking for the password. Note: I am trying to connect to FrontEnd server sftp SFTREGUP1@14.71.26.6 Connecting to 14.71.26.6... Password Authentication Password: Please help (14 Replies)
Discussion started by: Satyak
14 Replies
Login or Register to Ask a Question