Unix Technical Forum

Is tr broken? Doesn't seem to process char classes correctly.

This is a discussion on Is tr broken? Doesn't seem to process char classes correctly. within the Slackware Linux Support forums, part of the Unix Operating Systems category; --> I've shown 2 versions of tr operating below. Version 5 from slackware 10. And version 2 from slackware 7. ...


Go Back   Unix Technical Forum > Unix Operating Systems > Slackware Linux Support

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-19-2008, 02:39 PM
Skip
 
Posts: n/a
Default Is tr broken? Doesn't seem to process char classes correctly.

I've shown 2 versions of tr operating below. Version 5 from
slackware 10. And version 2 from slackware 7. Version 2 of tr
appears to working as expected, but version 5 doesn't.
Version 5 behaves abnormally on other char classes as well.

# tr version 5.2.1 appears to behave abnormally.
# Delete all punct chars using tr version 5.2.1 from Slackware 10.0
# note that \260 and \250 are not punct chars, but are deleted.
/bin/echo -e '\260\250?' | tr -d '[unct:]' | xxd
0000000: 0a .

# Delete all non-punct chars using tr version 5.2.1 from Slackware 10.0
# Note that \260 and \250 are non punct chars and should be deleted, but
# are not. The newline is deleted correctly. 'b0' is \260, 'a8' is \250.
/bin/echo -e '\260\250?' | tr -dc '[unct:]' | xxd
0000000: b0a8 3f ..?

# tr version 2.0 appears to behave normally.
# Delete all punct chars using tr version 2.0 from Slackware 7
# This behaves normally (to me). Only the '?' is deleted.
/bin/echo -e '\260\250?' | tr -d '[unct:]' | xxd
0000000: b0a8 0a ...

# Delete all non-punct chars using tr version 2.0 from Slackware 7
# This behaves normally (to me). All but the '?' are deleted.
/bin/echo -e '\260\250?' | tr -dc '[unct:]' | xxd
0000000: 3f ?

Is the new tr ok?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:39 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com