Csound Csound-dev Csound-tekno Search About

Re: a text formatting/Executor question

Date1997-04-24 14:45
FromToby
SubjectRe: a text formatting/Executor question
Dave Phillips wrote:
> Here's what I get:
>   f1 0 8192 10 1^Mi1 0.000000 0.000100 10200.301758 50.250000 0.500000
> 0.546584^Mi1   0.001000 0.000096 9985.474609 50.348255 0.499969
> 0.543260^M
>   [etc. for a gazillion lines all run together like that]

> can anyone tell me how I can automatically reformat the score so that
> the lines are arranged properly ? Btw, I don't have Perl, so please
> point me to something I could use within bash (or C or Tcl). I'm using
> Linux.


As I remember, text is output this way on the
following OS's:

UNIX LF
MAC  CR
DOS  CR/LF

Try this as a filter for your score output:

#include 

main()
{
char c;
        while( (c = getc(stdin)) != EOF){
                if(c == 13)
                        putc( '\n', stdout);
                else
                        putc( c, stdout);
        }
}

Save it to a file called 'chop.c' and do

make chop

Then do

chop < bogus > cool

I haven't tested this, but it looks to me
as though it should convert Mac text to 
Unix text.

Toby

	-There otta be a law-


P.S.  This would be the Dos to Unix Code:
(There could be no conceivable need for
 conversion from Unix to one of the other
 OS's --  Whoa, just kidding) 

#include 

main()
{
char c;
        while( (c = getc(stdin)) != EOF){
                if(c != 13)
                	putc( c, stdout);
        }
}


~
~
~