[lug] File conversion question

rm at fabula.de rm at fabula.de
Thu Nov 18 18:08:44 MST 2004

On Thu, Nov 18, 2004 at 05:55:38PM -0700, David Morris wrote:
> On Thu, Nov 18, 2004 at 05:32:17PM -0700, Jeff Schroeder wrote:
> > Paul asked:
> > 
> > > I have come into the posession of a large number of text files
> > > that have a ^M where there should be a \n character. What is the
> > > 'well known' trick for conversion to UNIX-tradition format using
> > > POSIX commands?
> > 
> > I thought there was a command "dos2unix" or something, but I can't find 
> > it.  A while back I wrote myself a little bash script that does exactly 
> > this...
> 'dos2unix' and 'unix2dos' are usually not installed by
> default on Linux machines.  On Debian you need to install
> the sysutils package, not certain what it is on other
> distributions (might be the same).

Sorry, maybe i misread the OP, but if there are '^M' _instead_
of \n than this is most likely _not_ a DOS file (that would
have spurious '^M'). My bet: this is an Apple file and i would
_highly_ recomend 'recode' for these kinds of jobs: 

 $ recode mac..latin1 

 recode -l will list all known encodings (you need to pipe this
 to your pager :-) 
 The manpage will be very helpfull as well since recode is a very
 powerfull tool.

  Ralf Mattes

> --David
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: lug.boulder.co.us port=6667 channel=#colug

More information about the LUG mailing list