public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Malcolm Boekhoff" <Malcolm.Boekhoff@actfs.co.uk>
To: "Cygwin News Group" <cygwin@sources.redhat.com>
Subject: Re: How do I remove CR/LF from text file
Date: Mon, 05 Feb 2001 08:14:00 -0000	[thread overview]
Message-ID: <012401c08f8e$cb352680$275c100a@actfs.co.uk> (raw)
In-Reply-To: <VA.0000060c.009232ab@thesoftwaresource.com>

DOS2UNIX
--------
You can strip out the carriage-return from carriage-return+line-feed with "tr" (i.e. DOS to Unix):

    tr -d \r <inputFile >outputFile

The "-d" means "delete".

UNIX2DOS
--------
However, I think you want to put the carriage-return in and I don't know how to do this. If you look at a Unix file (one with lines
separated by \n and not \r\n) in Notepad, you just see one great big line. You can look at the file in Word (and probably Wordpad)
and then save it as text. This will put the \r\n sequence back in. You can also use vim (part of Cygwin) to read the file in, change
the file type to "dos" (via ":set fileformat=dos") then save it.

----- Original Message -----
From: "Brian Keener" <bkeener@thesoftwaresource.com>
To: "cygwin" <cygwin@sourceware.cygnus.com>
Sent: Friday, February 02, 2001 4:49 PM
Subject: How do I remove CR/LF from text file


> I was working on some code and output a text file which displays fine in
> cygwin but I wanted to email the text to someone from within windows and
> if I look at the text in wordpad it looks fine but if I look at it in
> notepad then it is screwy and in either case if I try to cut and paste
> into my email program then the text is still real screwy and I don't want
> to have to edit it.  I assume this is a CR/LF issue - not a bug - I just
> can't figure out how to change it.
>
> The text was originally created by sending to /tmp/foo which is on /
> which is a binary mount and so I did a
>
> cat /tmp/foo > /windows/temp/foo
>
> in which case /windows is a text mount thinking this would fix it, but it
> does not.  If I however go back and recreate the text file by outputting
> it to /windows/temp/foo in the first place - then wordpad, notepad and my
> email on like it, again I am assuming this is CR/LF related but that is
> an assumption.
>
> Can someone provide me with a line that allows me to do a conversion
> after the fact like this or is there such a beast - On some unixen we had
> dos2unix and such.
>
> Thanks for any input.
>
>
>
> --
> Want to unsubscribe from this list?
> Check out: http://cygwin.com/ml/#unsubscribe-simple



--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

  parent reply	other threads:[~2001-02-05  8:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-02  8:50 Brian Keener
2001-02-02  9:11 ` Larry Hall
2001-02-02 10:03   ` Brian Keener
2001-02-02  9:45 ` Charles S. Wilson
2001-02-05  8:14 ` Malcolm Boekhoff [this message]
2001-02-05  9:36   ` Brian Keener
2001-02-02 10:11 Bernard Dautrevaux
2001-02-02 10:36 ` Brian Keener
     [not found] <EC421C2230BBD211A11400805FA7784D25DCE2@express8.res.utc.com>
2001-02-02 10:36 ` Brian Keener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='012401c08f8e$cb352680$275c100a@actfs.co.uk' \
    --to=malcolm.boekhoff@actfs.co.uk \
    --cc=cygwin@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).