At 1:21 AM -0700 6/24/2003, Nicholas G. Thornton wrote:
>
>As part of that I want to include a short script (or something on the
>commandline) to convert LF/CR to the appropriate type for Mac/Dos/Unix for all
>the necessary files. I know how to do this, But I'm wondering if there's some
>way I can reduce the script to essentially one line. Afterall, what good is a
>converter to make sure the scripts run right if you can't run it?
>
>As I recall there's a switch or some such that you can do on the commandline
>either when you run the main script or as the conversion script, but I don't
>recall how to do this. Any ideas?

Perhaps I misunderstand your question, but at the commandline, something like...

  perl -pi -e "s/(\015\012|\012|\015)/\n/g"

...(followed by a list paths to files) will translate to local newlines. Something 
close to it should also work from MacPerl's "One Liner" menu item, although I think a 
droplet would be easier to handle.

If you're looking for a way to pass switches into a script, you can prompt with 
MacPerl::Ask. There are examples in the MacPerl FAQ.

  http://www.macperl.com/depts/MacPerlFAQ.html

And I like using Getopt::Long in conjunction with this (and Getopt::Auto looks pretty 
slick as well).

-Charles
 http://euonymic.com/

-- 
Charles Albrecht                                  Euonymic Solutions Inc
[EMAIL PROTECTED]                                       P.O. Box 300623
C>303.619.7596  F>978.334.3061               Denver, Colorado 80203-0623
                http://euonymic.net/~charlesa/cv/

Reply via email to