Koozali.org: home of the SME Server

Legacy Forums => General Discussion (Legacy) => Topic started by: HB on September 22, 2002, 12:37:58 AM

Title: Is there an alternative to dos2unix?
Post by: HB on September 22, 2002, 12:37:58 AM
dos2unix is not on my e-smith

But I'm guessing there's an alternative to it - I just can't find it.

Thx!
Title: Re: Is there an alternative to dos2unix?
Post by: Rich Lafferty on September 22, 2002, 12:51:45 AM
perl -pe 's/\cM//'

tr -d '\015'

sed 's/^V^M//'   # that's control-V followed by control-M
 
:-)

Out of curiosity, how are the DOS-line-ended files getting to the server in
the first place? (If you're using FTP, transferrin them in ASCII mode instead
of BINARY mode will take care of the conversion for you.)

--Rich
Title: Re: Is there an alternative to dos2unix?
Post by: HB on September 22, 2002, 01:12:28 AM
Thanx!

I had a vague memory of the tr cmd - I better start getting into sed (and perl)! :-)

I'm pretty comfortable using emacs. But since there's no emacs on my box - I have the choice of vi, pico and emacs-from-my-windoze-box.
I don't know pico and can't stand vi - so I'm stuck with the windoze solution.

Would _love_ to get _real_ emacs on my box though... later...

You're so cool!

   ;-)
Title: Re: Is there an alternative to dos2unix?
Post by: Nathan Fowler on September 22, 2002, 07:59:10 AM
Why not?  There is a Win32 GNU port of emacs for windows:

http://www.gnu.org/software/emacs/windows/faq2.html#getting-emacs

Or more specifically:
http://ftp.gnu.org/gnu/windows/emacs/21.2/

Hope this helped,
Nathan
Title: Re: Is there an alternative to dos2unix?
Post by: Rich Lafferty on September 22, 2002, 09:30:31 AM
> I'm pretty comfortable using emacs. But since there's no emacs on my box - I
> have the choice of vi, pico and emacs-from-my-windoze-box.

Tsk, that won't do!

:) richl@allspice$ cat /etc/e-smith-release
Mitel Networks SME Server V5.5
:) richl@allspice$ rpm -qa | grep emacs
emacs-nox-20.7-34
emacs-20.7-34

I took those from a Red Hat 7.1 cd, IIRC. They're on rpmfind.net if nothing
else. Newer ones might even work if you want emacs 21. We've got our share of
emacs users around here. :-)

Cheers,
--Rich
Title: Re: Is there an alternative to dos2unix?
Post by: HB on September 22, 2002, 12:17:38 PM
Very cool!

A billion thanks to you Rich!

I've got an ok X-server on the windoze box (winaxe) and to me the win32 emacs is only a pseudo solution.

I actaully feared that installing emacs would lead me into another rpm dependency hell - so I never bothered. I will attempt it now, once I get connection to rpmfind.net...

"I'll be back"    ;-)

Holger
Title: Re: Is there an alternative to dos2unix?
Post by: Rich Lafferty on September 23, 2002, 01:43:01 AM
Note that those two emacs RPMs give you what Red Hat calls "emacs-nox",
the terminal-only emacs. Once you involve X you'll get into that dependency
hell you mentioned :-)

Cheers,
--Rich
Title: Re: Is there an alternative to dos2unix?
Post by: Ian Wells on September 23, 2002, 02:53:26 AM
If you still want a dos2unix, then you can download this perl implementation.
It is a single, small perl script.

DOS <-> Unix text Converter

http://www.ftls.org/en/examples/perl-tools/d2u-u2d.shtml

It gives you a new command d2u-u2d which converts both ways.

Ian
Title: Re: Is there an alternative to dos2unix?
Post by: HB on September 24, 2002, 12:29:36 AM
Wow!

Thanks guys - you've been really helpful.

I've got emacs-nox running now, which is really great. (I've run into the usual backspace-delete hell now, but I'll get past that...).

And I'll check out the perl utility too.

Thanks again!     :-)

Holger