[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Suggestion for tr / transliteration binutil
From: |
Pádraig Brady |
Subject: |
Re: Suggestion for tr / transliteration binutil |
Date: |
Wed, 27 Aug 2008 11:13:41 +0100 |
User-agent: |
Thunderbird 2.0.0.6 (X11/20071008) |
smu johnson wrote:
> Hi,
>
> I hope this is the right place to ask this. I think a very handy argument
> to add to the list of aliases for character classes in tr would be a new one
> that behaves like [:cntrl:], except that it will not include newline
> characters in that class.
>
> The reason is at work here I deal with XML data that people send us that has
> all sorts of strange characters in it, like ^@, ^Z, etc etc... and I'd like
> to use tr to quickly trip all this garbage out of there without it
> destroying the newline characters too...
This is not supported at present, but you may be able to get what you want with:
tr -c '[:print:]\n' .
Your suggestion has some merit though.
I've previously needed to do something similar:
http://code.google.com/p/fslint/source/browse/trunk/fslint-gui#122
Pádraig.