MLUG: Re: [MLUG] text file cr/lf annoyance
Re: [MLUG] text file cr/lf annoyance
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Again I'd suggest tr. IT's very good at removing all that crap.


"...If you want to build a ship, don't drum up people together to collect
wood and don't assign them tasks and work, but rather teach them to long
for the endless immensity of the sea." -- Antoine de Saint-Exupery

;):):-):):-):):-)8')
Michael McGlothlin <EMAIL:PROTECTED>
http://kavlon.org/projects/

On Wed, 2 Oct 2002, Mike Miller wrote:

> I know of four different formats for text files:
>
> source: http://ddl.jpl.nasa.gov/ddl/purpose/multiplat.pdf
>
> IBM PC
>    This is a line of text.<CR><LF>
> Macintosh
>    This is a line of text.<CR>
> UNIX workstation
>    This is a line of text.<LF>
> VAX/VMS workstation
>    <LENGTH>This is a line of text.*
>
> * This is the most common format supported under VMS.
>
>
> Which creates a crazy situation where I work because all four of these OSs
> are used here.  My most common problem is that I have IBM PC text files on
> a Unix machine.  This isn't a terrible problem because we have dos2unix to
> convert files.  On Solaris, I'd deal with it like this...
>
> dos2unix -ascii originalfile convertedfile ; mv convertedfile originalfile
>
> ...but who wants all that hassle?  How about something that works like
> this?:
>
> d2u filename
>
> Or better, something that can work with a list of filenames:
>
> d2u a* www/bobstuff/*
>
> So we could write a script.  I think perl can do this pretty efficiently
> so that we could avoid dos2unix and writing temp files.  What do you
> think?
>
> It seems to me that this does what we want for an individual text file:
>
> perl -pi -e 's/\015$//' filename
>
> Is there an easy way to make this into a script that will take filenames
> (possibly with wildcards) as input?  It would be nice if it would work
> with wildcards exactly as ls works with them.
>
> Mike
>
> --
> To unsubscribe, go to http://mlug.missouri.edu/members/edit.php
>
> Archives are available at http://mlug.missouri.edu/list-archives/
>

--
To unsubscribe, go to http://mlug.missouri.edu/members/edit.php

Archives are available at http://mlug.missouri.edu/list-archives/