1833716 Members
1913 Online
110063 Solutions
New Discussion

Stumped

 
SOLVED
Go to solution
Vito Sarducci
Regular Advisor

Stumped

I have a problem that i cannot figure out? I have an ftp process that ftp's a file to the HP systems 11.x. For some unknown reason, after it is ftp'd to my hp server, it has an added 0d or 0a character at the carriage return, so the file is not the same each time it is ftp'd?

Has anyone seen this issue before? Please advise?

Vito
Lifes too short to stress out, Enjoy every day you have on earth!
6 REPLIES 6
Scott Van Kalken
Esteemed Contributor
Solution

Re: Stumped

it sounds like the type isn't being set correctly.

What sort of machine is it being ftp'd FROM?
Rodney Hills
Honored Contributor

Re: Stumped

If the machine you are ftping from is another unix, then type doesn't matter. If it is a Windows/Dos machine, then be sure to set type to "ascii".

-- Rod Hills
There be dragons...
Dave La Mar
Honored Contributor

Re: Stumped

0A is hex for an ascii line feed.
0D is hex for a carriage return in ascii.
Turn this option off or remove from the file prior to ftp.
dl
"I'm not dumb. I just have a command of thoroughly useless information."
Darrell Allen
Honored Contributor

Re: Stumped

Hi Vito,

You need to ftp the file in ascii mode.

ftp has 2 modes: binary and ascii. binary mode transfers the file just like it is while ascii mode performs a translation (if needed) so that the ascii file will be in the native ascii format of the destination host. The most common translation is done between Windows and UNIX systems. Windows uses CR-LF (charriage return and line feed) to terminate lines is ascii files while UNIX uses a NL (newline) character. A NL is actually the same ascii character as a LF.

From an earlier post of mine:

^M is a carriage return. ^J is a line feed or in UNIX a newline. Verify this with man ascii.

When UNIX sees ^J it is interpreted as advance one line and return cursor to the leftmost column. DOS only interprets ^J as advance one line (as if you manually turned the platen on a typewriter). DOS needs an ^M to move the cursor to the leftmost column.

So one should always ftp ascii files in ascii mode because a function of ftp is the translation of ^J^M for DOS to just ^J for UNIX. dos2ux does the same thing to a file if it was transferred in binary mode.

If you just cat the file, extra ^M characters are not seen. It's just as if you are moving the cursor to the leftmost position and doing it again. vi or od will show the extra characters.

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)
Mary Ann Lipa
Valued Contributor

Re: Stumped

I guess you're using a Windows/Dos machine, so set transfer type to "ascii"

that should get you unstumped

;-)

d_b
Which is worse, smoking or picking your nose in a public place?
Ulrich Deiters
Frequent Advisor

Re: Stumped

Did you make sure that the
FTP mode had been "binary"
(if in doubt, enter "binary"
at the prompt)?
In "ascii" mode line feeds
are converted to CR/LF,
which might explain the
additional 0x0d.