tr: trying to find the right incantation of a character class...
Olivier Brunel
jjk at jjacky.com
Tue Aug 29 17:48:35 UTC 2017
On Tue, 29 Aug 2017 19:23:39 +0200 (CEST)
Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn at axis.com> wrote:
> ...to do this:
>
> $ echo 'hello world-1' | tr -d '[ -]'
>
> that is, remove all SPACES (0x20) and dashes (0x2D) in input? I get
echo 'hello world-1' | tr -d -- ' -'
> 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:
SETs in tr(1) aren't actually regex, so this doesn't apply. As shown
above, simply list the characters you wanna delete.
`man tr` tells us:
SETs are specified as strings of characters. Most
represent themselves.
HTH,
More information about the busybox
mailing list