Apache/Perl question
Ronny Serrano
RSerrano at heartsonfire.com
Fri Aug 19 18:02:51 EDT 2005
Found that I can do it with the following command on the linux box:
tr -d \'015' < windowsformat.txt > unixformat.txt
And that worked for me.
Thanks again for all the help.
RS
-----Original Message-----
From: discuss-bounces at blu.org [mailto:discuss-bounces at blu.org] On Behalf
Of John Chambers
Sent: Friday, August 19, 2005 5:47 PM
To: discuss at blu.org; discuss at blu.org
Subject: Re: Apache/Perl question
David Hummel writes:
| On Fri, Aug 19, 2005 at 04:58:23PM -0400, Ronny Serrano wrote:
| >
| > Thanks to everyone who pitched in with ideas on this. Turns out my
| > apache config needed to be tweaked a little. Then I was getting 500
| > errors. After 2 hours I found that it was because the damn Vi for
| > Windows was puttng the wrong carriage returns in the script and the
| > server was blowing up. The linux server just didn't like how the
| > carriage returns were formatted. When I write a simple script in vi
| > right on the linux box, it works fine.
| >
| > Anyone know of a good freeware editor that would convert a windows
| > notepad formated text file to unix/linux format.
|
| Here is a command line utility that will do it:
|
| http://www.thefreecountry.com/tofrodos/
|
| Also check your system for the "dos2unix" program. On my Debian
| system, dos2unix is a symlink to the fromdos program.
Are you sure that will handle a notepad-format file? Those have some
funny things in addition to the \r\n terminators. At least they used to.
I haven't looked at one for some years, so they may be better now.
To just munge the line terminators, I've long used a tiny perl script:
#!/usr/bin/perl -pi.dos
s/\r\n/\n/g;
I have that in my home directory as sh/dos2unix. I also
have the obvious counterpart as sh/unix2dos. There's also a sh/mac2unix
file:
#!/usr/bin/perl -pi.mac
s/\r/\n/g;
I once had some awk scripts to do this sort of thing, but this was
overly tricky, and turned out not as portable as I expected, so I
replaced them with the perl versions.
_______________________________________________
Discuss mailing list
Discuss at blu.org
http://olduvai.blu.org/mailman/listinfo/discuss
More information about the Discuss
mailing list