* lawson whitney <[EMAIL PROTECTED]> writes:

> G'day Steve, You know best what you want to do, but usually a file
> that has ^M where it should have ^J has ^J just after, so fromdos,
> FI, does exactly: tr -d "\r"

Yep, I discovered that as soon as I had run my script.  All the files
suddenly had all these extra blank lines in them.  So I duly changed
the tr line to 'tr -d "\r"'. :)

> Next, to use the same file at the end of a pipe as at the beginning
> may well truncate the file,

The thing I noticed about this was that sometimes it worked and
sometimes it didn't.  In other words, some of the files got through
ok, while others ended up with nothing in them (zero length).  To
overcome that, I piped to a temporary file and then mv'd the temp file
to the original.

> unless at the end of the pipe you use a
> program that doesn't open its output file until it has read all its
> input.  I don't know of a utility like that, so I use this:
> ---safe.c
<snip>

Looking at this now.  It appeals to me very much because of my efforts
to teach myself C. :-)



===========================
Want to really learn Linux?
   ... Install Slackware
===========================

-- 
|---<Regards, Steve Youngs>-------------------------------------|
|                    Genius is the ability to                   |
|              reduce the complicated to the simple             |
|------------------------------------<[EMAIL PROTECTED]>---|

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.linux-learn.org/faqs

Reply via email to