Ray,
Alternatively, one could do :
sed 's/$/^v^m/' (where the ^v denotes control-v and ^m denotes
control-m. This should work in bash)
The above will convert from "Unix" to "DOS". To convert from "DOS"
to "Unix" do :
sed 's/^v^m$//'
The advantage of this method is that 'sed' is one of the basic
Unix tools and one can assume safely that it will be present on any (not
just Linux) installation. The disadvantage of course is that it depends on
the shell that you use. Under 'bash', the '\r' character can be written by
typing control-v followed by control-m. Under another shell, the
keystrokes to represent this ascii character will be different.
Regards,
Kenneth
On Sat, 16 Oct 1999, Ray Olszewski wrote:
> Most any modern Linux distribution has a pair of commands to do this to a
> file. On my (Debian) system, they are called "todos" and "fromdos", though I
> believe the names vary from distribution to distribution. They can be used
> either on files (including wildcard specifications) or, via pipes, on STDIN
> and STDOUT (not sure how you want to use STDERR in this context).
>
> In the past (before these tools were standard), I wrote a similar pair of
> programs in perl. Easy; about 20 lines of code. Were I to do it today, I'd
> probably just write a perl or shell-script wrapper for these apps. You could
> probably also write a wrapper for sed to do the same thing. I don't know
> which choice would be fastest, and I don't know if any would be fast enough
> for your purposes ... I need to do this rarely enough that the speed of
> "fromdos" and "todos" is adequate for me.
>
> At 01:08 PM 10/16/99 -0700, Dan Browning wrote:
> >What utils are available (preferable ones that use STDIN, STDOUT, and
> >STDERR) to convert unix text files to DOS (win,etc.) text files and back?
> >Written in C, and can process gigabytes of small text files fast?
>
> ------------------------------------"Never tell me the odds!"---
> Ray Olszewski -- Han Solo
> Palo Alto, CA [EMAIL PROTECTED]
> ----------------------------------------------------------------
>
>