Re: [SLUG] Getting rid of ASCII 127 in a text file?

From: Glen (gurensan@tampabay.rr.com)
Date: Fri May 31 2002 - 13:08:37 EDT


I don't know how to do it in a script, but how about a pseudo-C program:

#include<stdio.h>

int main(){
        char c;
        open file for reading
        open processed_file for writing
        while(!feof(file)){
                getc(char, file);
                if(c != 0x7F){ /*7F is hex for ASCII 127 */
                        write char to processed_file
                }
        }
        return 0;
}

By *no means* is this complete, but I don't have time right now to write it
correctly. I wrote another program of the same type to strip out the
carriage returns from a DOS text file (when the stupid command to do it
wasn't doing it right) so I know it works. If someone on the list knows C,
they can probably flesh this out for you in no time flat. If nobody posts it
later on I might have time in the morning or something like that.

        Glen

On Friday 31 May 2002 11:21 am, you wrote:
> On Fri, 2002-05-31 at 08:37, awyatt@fewt.com wrote:
> > cat file | sed -e s#\127##gi>anotherfilename
>
> That transforms the title "The giggle kids present 127 reproducible
> activities for the early childhood teacher" into "The giggle kids
> present reproducible activities for the early childhood teacher".
>
> Hmm... maybe I need a hex editor.
>
> Ben



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 19:39:08 EDT