[GRLUG] unix2dos?

Josh leapole at gmail.com
Sat Aug 24 17:24:15 EDT 2013


Hey, I need to do that in ruby so i can dump my unix2dos

Good Call Don.

Josh


On Sat, Aug 24, 2013 at 12:51 PM, Don Ellis <don.ellis at gmail.com> wrote:

> Sometimes a text editor handles it just fine, but it can require
> actually looking at the documentation to find out how. In Vim, for
> example, the settings for filetype vs. fileformat may not be that
> obvious. Once you figure it out, it becomes drop dead easy.
>
> Some text editors can be scripted to batch process a list of files.
> Consider Perl to be one such editor; dos2unix etc can be written as a
> one-liner command line, though some safeguards might be a good idea
> for some users, as in this easily found (but somewhat verbose)
> example:
>
>     http://www.obviously.com/tech_tips/dos2unix.html
>
> The active part in this example is:
>
>        while( <INPUT> ) {
>             s/\r\n$/\n/;     # convert CR LF to LF
>             print OUTPUT $_;
>         }
>
> Another example is:
>
>     http://www.wellho.net/resources/ex.php4?item=p210/cv
>
> This example is really a one liner with comments detailing why it was
> written that way. It could as easily be issued on the command line
> without a saved script, using the -e switch, as in:
>
>     perl -p -i.bak -e "s/foo/bar/; ... "
>
> (Camel 2, Chapter 6, on my favorite page in the whole book)
> The page on these switches (-p, -i, -e) explains why the first example
> can be rewritten with the magic input operator (<>), then why it can
> all be done on a single line.
>
> I do kind of like writing the one liner into a script (or alias, or
> shell function) so it's handy to get to and I don't have to remember
> the scripting details. Otherwise, using vim or your favorite editor is
> very handy too.
>
> --Don Ellis
>
>
> On Sat, Aug 24, 2013 at 1:16 PM, Adam Tauno Williams
> <awilliam at whitemice.org> wrote:
> >
> > On Sat, 2013-08-24 at 12:19 -0400, Eric Beversluis wrote:
> > > I'm reading in Sobell, _Linux Commands..._, where he talks about
> > > unix2dos being necessary to send Linux text files to a Windows machine,
> > > and am confused.
> > >
> > > I think that I successfully send text files back and forth between
> > > Linux, Windows and Mac all the time without having to use this utility.
> > > Is this something that is obsolete in more modern operating systems? Or
> > > do the text editors now handle this automatically?
> >
> > SOME editors handle it correctly.   For example - notepad.exe does not,
> > but wordpad.exe will work just fine.
> >
> > There really isn't and problems with the files, it just depends on what
> > you want to do.
> _______________________________________________
> grlug mailing list
> grlug at grlug.org
> http://shinobu.grlug.org/cgi-bin/mailman/listinfo/grlug
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shinobu.grlug.org/pipermail/grlug/attachments/20130824/16b845ca/attachment-0001.html>


More information about the grlug mailing list