On 2003-02-26 17:56, Tijl Coosemans <[EMAIL PROTECTED]> 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?
The shell opens filename for input and then attempts to reopen it once
more for output, at the same time. The '>' operator truncates the
file. You will get much better and more predictable results if you
use a temporary file to store the intermediate result of tr(1):
$ tr -d '\r' < filename > filename.tmp
$ mv filename.tmp filename
- Giorgos
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message