Removing junk characters from text files?

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


On Thu, 10 Feb 2005, Lennart Sorensen wrote:
> > What I am looking for is a way to strip these characters out...
> 
> How about this for a filter:
> #!/usr/bin/perl
> while(<>) {
> ...

Consider as an alternative:

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

That deletes exactly the characters which are neither printable nor
newlines. 

"perl is an OK operating system, but it lacks a lightweight scripting
language." -- Walter Dnes

                                                          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