[Coco] Source code request...

Neil Morrison neilsmorr at hotpop.com
Sun Sep 5 13:30:32 EDT 2004


----- Original Message ----- 
From: "Dave" <daveekelly at earthlink.net>


> Neil Morrison wrote:
> > Use 'tr'.
> >
> > $ tr '\012' '\015' <sourcefile >destfile
> >
> > should do it. Be sure to use forward quotes, not backquotes.
>
> Ok, what you show above works.
>
> Why does this give me zero length files?
>
> for i in *.c; do echo $i; tr '\015' '\012' <$i >$i; done

for i in *.c; do echo ${i}; tr '\015' '\012' <${i} >${i}.tmp; mv ${i}.tmp
${i}; done

(assuming there are no *.tmp files)

It's important to note that "< > >> |" are ruthless - they operate first
before anything else. ">" will truncate all files before any other parsing
of the line is done.

> also, can I do this?
> for i in *.c *.h
> and take care of 2 extensions at one pass.

Sure.

Neil




More information about the Coco mailing list