Date: Thu, 18 Oct 2012 21:03:44 GMT From: Garrett Cooper <yanegomi@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/172862: sed improperly deals with escape chars Message-ID: <201210182103.q9IL3iAU096385@red.freebsd.org> Resent-Message-ID: <201210182110.q9ILA0v8006925@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 172862 >Category: bin >Synopsis: sed improperly deals with escape chars >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Oct 18 21:10:00 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Garrett Cooper >Release: 9.1-STABLE >Organization: EMC Isilon >Environment: FreeBSD bayonetta.local 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #0 r240836M: Sat Sep 22 12:30:11 PDT 2012 gcooper@bayonetta.local:/usr/obj/store/freebsd/stable/9/sys/BAYONETTA amd64 >Description: sed doesn't appear to be doing the right thing with escape chars (in this case '\t'); it's not properly reinterpreting '\t' as \011, but is instead interpreting it was 't': $ echo "foot " | sed -e 's/[\\t ]*$//' | hexdump -C 00000000 66 6f 6f 0a |foo.| 00000004 $ echo "foot " | sed -E -e 's/[\\t ]*$//' | hexdump -C 00000000 66 6f 6f 0a |foo.| 00000004 GNU sed does do the right thing with escape chars (verified on Fedora 17): # cat /etc/redhat-release Fedora release 17 (Beefy Miracle) # echo foot | sed -e 's/[\t ]*$//' | hexdump -C 00000000 66 6f 6f 74 0a |foot.| 00000005 # echo "foot " | sed -e 's/[\t ]*$//' | hexdump -C 00000000 66 6f 6f 74 0a |foot.| 00000005 >How-To-Repeat: echo foot | sed -e 's/[\t ]*$//' >Fix: >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210182103.q9IL3iAU096385>