GNU bug report logs - #28316
tr -d

Previous Next

Package: coreutils;

Reported by: John Pateman <jpateman <at> gmail.com>

Date: Fri, 1 Sep 2017 15:09:02 UTC

Severity: normal

Tags: notabug

Done: Eric Blake <eblake <at> redhat.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 28316 in the body.
You can then email your comments to 28316 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#28316; Package coreutils. (Fri, 01 Sep 2017 15:09:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to John Pateman <jpateman <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Fri, 01 Sep 2017 15:09:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: John Pateman <jpateman <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: tr -d
Date: Fri, 1 Sep 2017 12:28:32 +0100
[Message part 1 (text/plain, inline)]
macOS 10.12.

Problems with tr -d
Removal of character 'd' from test string when tr invoked with -d
incantation.

Example

[abc <at> xyx] ~ $ echo uuid:8ddddb8d5 | tr -d 'uuid:'

Expected output
8ddddb8d5

Actual output
8b85
[Message part 2 (text/html, inline)]

Added tag(s) notabug. Request was from Eric Blake <eblake <at> redhat.com> to control <at> debbugs.gnu.org. (Fri, 01 Sep 2017 17:10:01 GMT) Full text and rfc822 format available.

Reply sent to Eric Blake <eblake <at> redhat.com>:
You have taken responsibility. (Fri, 01 Sep 2017 17:10:02 GMT) Full text and rfc822 format available.

Notification sent to John Pateman <jpateman <at> gmail.com>:
bug acknowledged by developer. (Fri, 01 Sep 2017 17:10:03 GMT) Full text and rfc822 format available.

Message #12 received at 28316-done <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: John Pateman <jpateman <at> gmail.com>, 28316-done <at> debbugs.gnu.org
Subject: Re: bug#28316: tr -d
Date: Fri, 1 Sep 2017 12:09:08 -0500
[Message part 1 (text/plain, inline)]
tag 28316 notabug
thanks

On 09/01/2017 06:28 AM, John Pateman wrote:
> macOS 10.12.
> 
> Problems with tr -d
> Removal of character 'd' from test string when tr invoked with -d
> incantation.
> 
> Example
> 
> [abc <at> xyx] ~ $ echo uuid:8ddddb8d5 | tr -d 'uuid:'

That asks tr to delete all individual instances of 'd', 'i', 'u', and
':' in the input string, regardless of their context.

> 
> Expected output
> 8ddddb8d5
> 
> Actual output
> 8b85

The behavior you observed was correct. To get what you want, you need to
use a tool that can do substring removal, rather than individual
character removal; sed and awk are such tools:

$ echo uuid:8ddddb8d5 | sed s/uuid://
8ddddb8d5

As such, I'm tagging this as not a bug; but feel free to reply with any
further questions on the topic.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

[signature.asc (application/pgp-signature, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 30 Sep 2017 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 268 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.