Date: Wed, 26 Feb 2003 11:01:13 -0600 From: Krzysztof Parzyszek <kristof@swissmail.org> To: Tijl Coosemans <tijl@ulyssis.org> Cc: freebsd-questions@FreeBSD.ORG Subject: Re: cat Message-ID: <20030226170113.GA5008@arcturus.student.iastate.edu> In-Reply-To: <20030226175613.5e61f45e.tijl@ulyssis.org> References: <20030226175613.5e61f45e.tijl@ulyssis.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Feb 26, 2003 at 05:56:13PM +0100, Tijl Coosemans wrote:
> I want to remove CRs from text files so what I did is this:
>
> cat filename | tr -d '\r' > filename
>
> However, I often end up with an empty file. Just out of
> interest, somebody who knows why that is?
Because the shell can open `filename' for writing (because of
output redirection) and thus truncate it to 0 bytes before
cat opens it for reading.
Try
cat filename | tr -d '\r' > filename.new
instead.
--
<>> kristof@swissmail.org <Krzysztof Parzyszek> 9/2/2002
<<> "If you can't convince them, confuse them" -- HS Truman
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030226170113.GA5008>
