cancel
Showing results for 
Search instead for 
Did you mean: 

dos2ux || ux2dos

SOLVED
Go to solution
V.P
Frequent Advisor

dos2ux || ux2dos

Hi Admins,
How do I find that the file which is transferred from windows machine to HP-UX in Binary mode or ASCII mode?

Assume I have set the file transfer mode as auto select in ftp and transferring the file.

Thanks,
V.P
7 REPLIES
Dennis Handly
Acclaimed Contributor

Re: dos2ux || ux2dos

If you transfered it wrong, you'll see lots of extra CRs at the end of each line.
Or if you use dos2ux(1) on each file, nothing will change.

If you have binary files that have been transferred in ASCII, they will be corrupted.
V.P
Frequent Advisor

Re: dos2ux || ux2dos

Hi Dennis,

Thanks for the quick response.

Any command in HP-UX to find the transferred file is in ASCII mode or Binary mode?

I transferred one file from windows desktop to HP-UX box and using â viâ editor, I was unable to find the ^M character. But when I executed the script, script terminated by giving the error ^M at the end of the command line.

Regards,
V.P
Johnson Punniyalingam
Honored Contributor

Re: dos2ux || ux2dos

>>Any command in HP-UX to find the transferred file is in ASCII mode or Binary mode? <<

Once file has been transfered you can use

file command

file

Problems are common to all, but attitude makes the difference
V.P
Frequent Advisor

Re: dos2ux || ux2dos

Hi Johnson,

Thanks for your response.

I have done the test file transfer (CMR3423.sh is in binary format & CMR.sh is in ASCII format). The output of file gave a similar output.

Could you please check the same?

Steps:

Hostname /tmp >file CMR3423.sh
CMR3423.sh: English text

Hostname /tmp >dos2ux CMR3423.sh > CMR.sh

Hostname /tmp >file CMR.sh
CMR.sh: English text

Notepad enclosed for further understanding.
Dennis Handly
Acclaimed Contributor

Re: dos2ux || ux2dos

>Any command in HP-UX to find the transferred file is in ASCII mode or Binary mode?

Not really. Nobody cares much about those CRs if there is lots of ASCII data.

>I was unable to find the ^M character.

Your attached file shows ^M.

>I have done the test file transfer (CMR3423.sh is in binary format & CMR.sh is in ASCII format).

Yes, the first has those CRs(^M) and the second is fixed.
James R. Ferguson
Acclaimed Contributor
Solution

Re: dos2ux || ux2dos

Hi:

As you have seen, using the 'file' command will tell you that the file is "ascii text" regardless of whether or not its line terminators are simple newlines (\012) or carriage-return/newlines (\015\012) sequences.

To determine if you have carriage-return (CR)/newline(CRLF) sequences you can examine the file with 'cat', 'vis' or a commandline Perl script:

# cat -etv file

...will show ^M for a CR

# vis file

...will show \r lfor a CR

# perl -ne 'print if m{\r\n}' file

...will print _only_ lines with CRLF sequences, if any.

Regards!

...JRF...
V.P
Frequent Advisor

Re: dos2ux || ux2dos

Thanks JRF.

Regards,
V.P