CRLF / LF Conversion
William R. Knox
wknox at mitre.org
Tue Sep 26 18:36:10 GMT 2000
I had to write the following little PERL script for a bunch of people
who were running into CR/LF problems with Macs and Netatalk. It converts
all the files ending in .shtm, .htm, .html, and .shtml (regardless of
case) given as arguments, and recursively searches for all the files in
directories given as arguments matching the same expression, changing CR
to LF. To put it more bluntly,
./correct_cr_lf.pl file1.html directory2 ...
It could be easily modified to change CRLF to LF or vice versa by
changing the values of $OLD_EOL and $NEW_EOL.
Let me know if you find it useful.
Senior Operating Systems Programmer/Analyst
The MITRE Corporation
Peter Samuelson wrote:
> [cybrgeek at xmission.com <cybrgeek at xmission.com>]
> > > It is my understanding that Samba cannot do CRLF / LF Conversion
> > > when needed (from CRLF-LF-Conversions.txt).
> Correct, and for very good reasons.
> > > I am currently sharing my html directory which had be edited via
> > > pico. Assuming that all my html files are either .html or .htm,
> > > what would be the best way to convert them to the windows end
> > > lines?
> > Look into the dos2unix and unix2dos programs. They do the CR/LF<->NL
> > translations very well.
> Note also that if you don't have the utilities handy, use
> unix2dos-in-place == perl -pi -e 's/$/\015/' filename(s)
> dos2unix-in-place == perl -pi -e 's/\015$//' filename(s)
> or similar with tr, sed, mv, rm and redirecting.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2322 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba/attachments/20000926/2d8e96fb/correct_cr_lf.bin
More information about the samba