Removing junk characters from text files?

Henry Spencer henry-lqW1N6Cllo0sV2N9l4h3zg at public.gmane.org
Thu Feb 10 21:34:44 UTC 2005


I wrote:

	tr -cd '\n[:print:]'

Wups, one small snag with that:  tr may have its own ideas about just what
characters are printable.  To nail it down, if necessary:

	tr -cd '\n\040-\176'

That gets rid of everything except newlines and the printable ASCII
characters.  (\177, aka character 127, is not printable.)

                                                          Henry Spencer
                                                       henry-lqW1N6Cllo0sV2N9l4h3zg at public.gmane.org

--
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