Hi all, I have a problem with Samba's formatting of plain text files transferred from my NT 4 machine. Linux inserts a ^M (carriage return) into every file at the end of every line. Is there a way to configure Samba so it doesn't do this? I'd hate to FTP to my Samba share; it kind of defeats the purpose. If anyone has any ideas I would be most appreciative. Thanks in advance Mark Shaw
Mark, It is NOT samba that is doing this - samba does not change the file as it is transferred (which ftp in ascii mode does), which is at the root of your problem (perhaps a poor way to state this, really, as this is desirable behavior). Windows, Macs, and Unix all have different ideas of how the end of a line should be indicated in a text file. The carriage returns you see are the result of this inconsistency. The program dos2unix (a standard part of the install on Solaris and I believe Linux as well) can be run to remove them ("dos2unix filename filename" will convert the file to unix format and rewrite it back to the same filename), or you can use a simple sed script as well. Good luck. -- Bill Knox Senior Operating Systems Programmer/Analyst The MITRE Corporation Mark Shaw wrote:> > Hi all, > > I have a problem with Samba's formatting of plain text files transferred from my > NT 4 machine. Linux inserts a ^M (carriage return) into every file at the end > of every line. Is there a way to configure Samba so it doesn't do this? I'd > hate to FTP to my Samba share; it kind of defeats the purpose. If anyone has > any ideas I would be most appreciative. > > Thanks in advance > > Mark Shaw
Mark, If you have perl installed on the AIX machine, you can use that to do the conversion. I have attached a script that I wrote to do the conversion recursively on html files in a directory that could be modified to do specific files. Good luck with whatever you decide. -- Bill Knox Senior Operating Systems Programmer/Analyst The MITRE Corporation Mark Shaw wrote:> > Bill, > I am aware of the dos->unix conversion fault that occurs here. I'd like to find > a way around it. The files move from my Samba share to an AIX system and > neither have dos2unix installed. I have tried to use fromdos on the Linux > machine but this takes too long, and hasn't actually worked yet. Do you know of > any other transfer protocols that may work? Or maybe an AIX product that will > do the conversion? > > Thanx > Mark > > "William R. Knox" <wknox@mitre.org> on 2000/11/22 04:53:44 AM > > To: Mark Shaw/ISM-BC@ISM-BC > cc: samba@us5.samba.org > Subject: Re: Plain text file transfer problem > > Mark, > It is NOT samba that is doing this - samba does not change the file as > it is transferred (which ftp in ascii mode does), which is at the root > of your problem (perhaps a poor way to state this, really, as this is > desirable behavior). Windows, Macs, and Unix all have different ideas of > how the end of a line should be indicated in a text file. The carriage > returns you see are the result of this inconsistency. The program > dos2unix (a standard part of the install on Solaris and I believe Linux > as well) can be run to remove them ("dos2unix filename filename" will > convert the file to unix format and rewrite it back to the same > filename), or you can use a simple sed script as well. > > Good luck. > > -- > Bill Knox > Senior Operating Systems Programmer/Analyst > The MITRE Corporation > > Mark Shaw wrote: > > > > Hi all, > > > > I have a problem with Samba's formatting of plain text files transferred from > my > > NT 4 machine. Linux inserts a ^M (carriage return) into every file at the end > > of every line. Is there a way to configure Samba so it doesn't do this? I'd > > hate to FTP to my Samba share; it kind of defeats the purpose. If anyone has > > any ideas I would be most appreciative. > > > > Thanks in advance > > > > Mark Shaw-------------- next part -------------- A non-text attachment was scrubbed... Name: correct_cr_lf.pl Type: application/x-perl Size: 2184 bytes Desc: not available Url : http://lists.samba.org/archive/samba/attachments/20001122/1a465e25/correct_cr_lf.bin
Thank you very much Bill! That script looks like it'll do the trick! Best Regards, Mark "William R. Knox" <wknox@mitre.org> on 2000/11/22 04:53:44 AM To: Mark Shaw/ISM-BC@ISM-BC cc: samba@us5.samba.org Subject: Re: Plain text file transfer problem Mark, It is NOT samba that is doing this - samba does not change the file as it is transferred (which ftp in ascii mode does), which is at the root of your problem (perhaps a poor way to state this, really, as this is desirable behavior). Windows, Macs, and Unix all have different ideas of how the end of a line should be indicated in a text file. The carriage returns you see are the result of this inconsistency. The program dos2unix (a standard part of the install on Solaris and I believe Linux as well) can be run to remove them ("dos2unix filename filename" will convert the file to unix format and rewrite it back to the same filename), or you can use a simple sed script as well. Good luck. -- Bill Knox Senior Operating Systems Programmer/Analyst The MITRE Corporation Mark Shaw wrote:> > Hi all, > > I have a problem with Samba's formatting of plain text files transferred frommy> NT 4 machine. Linux inserts a ^M (carriage return) into every file at the end > of every line. Is there a way to configure Samba so it doesn't do this? I'd > hate to FTP to my Samba share; it kind of defeats the purpose. If anyone has > any ideas I would be most appreciative. > > Thanks in advance > > Mark Shaw