tr equivalent to sed command

夜神 岩男 supergiantpotato at yahoo.co.jp
Fri Feb 24 13:38:22 UTC 2012


On 02/24/2012 10:12 PM, fedora wrote:
> On 02/24/2012 01:22 PM, 夜神 岩男 wrote:
>> I'm trying to move a script from invoking lots of sed and awk to bash
>> builtins and I'm stumped on something I'm sure is simple.
>>
>> Is there a tr equivalent to the following?
>> sed 's/[^[:alnum:]]//g'

 > Try
 >
 > tr -c [:alnum:] ....
 >
 > -c --complement
 >
 > suomi

Almost, but that got me on the right track. I needed:

tr --delete --complement [:alnum:]

and presto!
I knew it had to be something really, really silly I was overlooking. 
Something such as, for example, the very first switch in the manpage.

Thanks!


More information about the users mailing list