tr: trying to find the right incantation of a character class...
Cristian Ionescu-Idbohrn
cristian.ionescu-idbohrn at axis.com
Wed Aug 30 12:03:01 UTC 2017
On Tue, 29 Aug 2017, Olivier Brunel wrote:
> 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.
Thanks a lot for putting me on the right track ;)
Cheers,
--
Cristian
More information about the busybox
mailing list