Removing junk characters from text files?
John Macdonald
john-Z7w/En0MP3xWk0Htik3J/w at public.gmane.org
Fri Feb 11 05:47:05 UTC 2005
On Thursday 10 February 2005 20:08, William O'Higgins wrote:
[ ... ]
>
> Henry Spencer's solution:
>
> > tr -cd '\n\040-\176'
> >
> >That gets rid of everything except newlines and the printable ASCII
> >characters. (\177, aka character 127, is not printable.)
>
> That worked great, but it took me a while to remember how to put that on
> a command line, like so:
>
> cat filewithcrap.csv | tr -cd '\n\040-\176' > crapfree.csv
Dating from back in the days when every process used a significant portion
of the available memory, I always shudder slightly when I see cat used
to redirect input into a pipeline. Just use:
tr -cd '\n\040-\176' < filewithcrap.csv > crapfree.csv
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy
mailing list