...to do this:

$ echo 'hello world-1' | tr -d '[ -]'

that is, remove all SPACES (0x20) and dashes (0x2D) in input?  I get 
mixed results with both various versions of busybox but also with the 
coreutils `tr' and the characters order placed in the character class.

`man 7 regex' is telling us:

        To  include a literal '-', make it the first or last 
        character, or the second end-point of a range.
        To use a literal '-' as the first endpoint of a range, enclose 
        it in "[."  and  ".]" to make it a collating element (see 
        below).  To use a literal '-' as the first endpoint of a 
        range, enclose  it  in "[."  and  ".]" to make it a 
        collating element (see below).  With the exception of these 
        and some combinations using '[' (see next paragraphs), all 
        other special  characters, including '\', lose their special 
        significance within a bracket expression.

and so on.

So, I could list a few unintuitive character classes that would 
produce unintuitive results, with both coreutils `tr' and busybox 
`tr'.  What is the correct incantation that would always work as 
expected?


Cheers,

-- 
Cristian
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to