[TriLUG] Elim. unwanted characters

Rodney Radford rradford at mindspring.com
Tue Mar 14 11:31:48 EST 2006


"man tr" should show you what you need - it is a a translate utility for 
translating any character set to any other character set. 

I think the command "tr \000 \040" will do what you want.

-----Original Message-----
>From: Mark Freeze <mfreeze at gmail.com>
>Sent: Mar 14, 2006 11:22 AM
>To: Triangle Linux Users Group discussion list <trilug at trilug.org>
>Subject: [TriLUG] Elim. unwanted characters
>
>I'd like to solicit ideas for the best way to handle the following problem:
>
>I receive 10 - 20 text files per day from various sources.  Several of
>the files that I receive are from mainframe shops. (Who can't change
>their processes for anything.) When I receive the files, certain
>sections are loaded with null characters instead of spaces.  Since I
>currently transfer these files to my PC for manual processing, I have
>been opening the files in UltraEdit, viewing the hex, and replacing
>(00) with (20).
>
>Does anyone know of a utility that I could use to automate this
>process?  Maybe use cron to look for files in a certain directory and
>then run a program to do a 'search and  replace' for these characters?
>
>If I were going to write my own utility in C++, what would be the
>quickest way to read in chunks of data and then do the search and
>replace?  Character by character is slow as some of these files are 80
>- 100 MB.
>
>I'm just getting started on this process so any suggestions are welcome.
>
>Thanks,
>Mark.
>--
>TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
>TriLUG Organizational FAQ  : http://trilug.org/faq/
>TriLUG Member Services FAQ : http://members.trilug.org/services_faq/




More information about the TriLUG mailing list