TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TCLUG:1906] Shell Script Question -- CR/LF



Hi All.  I work in a Windows 95 environment making and modifying HTML
documents to go on a Unix server. This of course means I am plauged with
the CR/LF nonsense constantly. Whenever I download a page to work on
offline, Windows goes and adds another ^M to the end of the line --
after several edits there can be a page of returns between every line of
text. I have tried to keep this crap to a minimum by saving files in
"unix" format in Homesite 3.0 (our development tool), but that doesn't
completely eliminate the problem. Also, our unix sysadmin is well...a
moron, so there are no real tools installed on the server (no X, no
emacs, not even pico...hell, less isn't even installed), and no ability
to install them myself. Vi is the only editor I have avalible. 

This helps me somewhat (just last week I tried to figure out how to get
vi to remove the accurssed ^M's, unsuccessfully):

Brad DeJong wrote:
> 
> Just to clarify, (this list has had this discussion before I think).  A
> few ways to do this quickly:  in vi, :%s/[^L-^N]//g converts CR/LF to
> just LF quite nicely.  There is also a dos2unix command that does this
> (if my memory serves me correctly).  tr also works if invoked properly.

But what I would like to do is write a shell script to remove the ^M
from every file in a directory. Brad says tr can be used for this, but I
have no experience with this tool...what parameters would I need to give
it in order to make this work?

Luke Francl
(First time tclug poster! be gentle...)