I think I'm overlooking something simple. I have a bunch of ID numbers and I want to replace all occurances of numbers that are NOT 1-4 with an x. However, both of these solutions give me the same anser:
$ echo '12345' | perl -plne 'y/[1234]/x/' xxxx5 $ echo '12345' | perl -plne 'y/[^1234]/x/' xxxx5 $ echo '12345' | tr '[^1234]' 'x' xxxx5 $ echo '12345' | tr '[1234]' 'x' xxxx5 The caret (^) is supposed to negate the character class, but doesn't seem to. I could specify the positive in this case, which works: $ echo '12345' | tr '[5-90]' 'x' 1234x but that regular expression would miss letters and symbols, which may also exist. I really do want the negated character class. What am I overlooking? Regards, - Robert --~--~---------~--~----~------------~-------~--~----~ Central West End Linux Users Group (via Google Groups) Main page: http://www.cwelug.org To post: [email protected] To subscribe: [EMAIL PROTECTED] To unsubscribe: [EMAIL PROTECTED] More options: http://groups.google.com/group/cwelug -~----------~----~----~----~------~----~------~--~---
