1830225 Members
1413 Online
109999 Solutions
New Discussion

Samba Problems

 
SOLVED
Go to solution
Fernando Jose P de Souz
Regular Advisor

Samba Problems

i have a problems with samba.
when i copy a text file windows to HP-UX,
in the file, place ^M the end of the each line.
7 REPLIES 7
John Poff
Honored Contributor

Re: Samba Problems

Hi,

Your text file in Windows has a carriage return and line feed characters at the end of each line, while in Unix the lines are just terminated with line feeds. You'll need to run the 'dos2ux' command to remove the CR characters from your file.

Samba doesn't remove these characters because it is too difficult to figure out when to remove them and when not to.

JP
Fernando Jose P de Souz
Regular Advisor

Re: Samba Problems

Where i find the dos2ux command?
John Poff
Honored Contributor

Re: Samba Problems

The 'dos2ux' command should be a standard part of an HP-UX 11.X system. On our boxes it is located at /usr/bin/dos2ux. The man page explains it all. Just try 'dos2ux filename'.

JP
Fernando Jose P de Souz
Regular Advisor

Re: Samba Problems

but i always have to execute this command when i copy the file??

Don't exist other option ??
Camel_1
Valued Contributor

Re: Samba Problems

In this case you have to check how's the script created in Windows environment?

Simon
John Poff
Honored Contributor
Solution

Re: Samba Problems

No, there isn't really any other option. When you use FTP it will do the CR/LF conversion for you, but Samba won't. Does having the CR in the file create a problem for you in HP-UX?

I suppose you could write a script that runs periodically, looks for new files, and runs 'dos2ux' on them.

JP
Chris Saunderson
Frequent Advisor

Re: Samba Problems

From the Samba documentation:

--[begin extract]--
Unix text-file lines are terminated by 0A (LF)

MS text-file lines are terminated by 0D 0A (CR LF)

Samba does not do and will not do any conversion of these files at all. There are a number of conversion utilities on both platforms, these will have to be used. Samba 2.0.4 introduced a new document saying this, it vanished again in version 2.2.0.
I saw a Perl-script recently that purported to do the conversion, so if you have access to Perl try:

# cat file.unix | perl -e 'while (<>) {$_ =~s/$/\015/; print$_}' > file.dos

--[end extract]--
Ted Nugent called. He wants his shirt back.