Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 May 2003 11:32:16 +0200
From:      Kjell Midtseter <kmidtset@c2i.net>
To:        Fernando Gleiser <fgleiser@cactus.fi.uba.ar>
Cc:        questions@freebsd.org
Subject:   Re: Maybe OT: Automatic CRLF conversion?
Message-ID:  <20030523093216.GA396@tina.la3sg.net>
In-Reply-To: <20030522165345.O35791-100000@cactus.fi.uba.ar>
References:  <20030522165345.O35791-100000@cactus.fi.uba.ar>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday, 22 May 2003 at 17:05:11 -0300, Fernando Gleiser wrote:
> Here's my problem: I have a FreeBSD server running an aplication.
> The operators of the aplication (read: people who doesn't know Unix)
> need to upload some files to the server, and the aplication reads them.
> 
> The files are flat ASCII.
> They where using FTP in ASCII mode for that, but they wanted it
> to be "even easier", so I set up Samba on the server and they just
> drag and drop the files. The problem is with the CRLF conversion,
> because the app needs the files the unix way, but they upload them
> the DOS way.
> 
> I need an automatic way to handle the conversion, since there is nobody
> who knows Unix there, and I can't tell them "run such command". They
> have no shell access.
> 
> 
> I was thinking of writing a little script which runs from cron, converts
> the files and then moves them to the final dir, but maybe there is a way of

May be this would be of help:
Removing ^M at the end of each line
perl -i.bak -npe 's/\r\n/\n/g' <file>
where <file> is the name of the file you want to "clean".
The original file is copied to <file>.bak...
Regards from Kjell

> doing it from samba itself.
> 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030523093216.GA396>