bug-sed
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#47281: sed: problem with hex replace a literal '$'


From: Bastian Bittorf
Subject: bug#47281: sed: problem with hex replace a literal '$'
Date: Sat, 20 Mar 2021 09:56:43 +0000

Dear hard working developers,

when replacing in hex mode, and a '$' = \x24 is at
the end of the search string, it seems to be parsed
as 'end', which was at least not intended by my usage:

e.g.
# echo 'foo $bar$ baz' >testfile

# hexdump -C testfile
00000000  66 6f 6f 20 24 62 61 72  24 20 62 61 7a 0a        |foo $bar$ baz.|
#                     ^^^^^^^^^^^^^^^

# i want to replace '$bar$'
# sed 's/\x24\x62\x61\x72\x24/\x65\x65\x65\x65\x65/' testfile
foo $bar$ baz

(no match/replacement happens)

# now omit the last char '$'
# sed 's/\x24\x62\x61\x72/\x61\x65\x65\x65/' testfile
foo aeee$ baz

# now making the match on char longer:
# sed 's/\x24\x62\x61\x72\x24\x20/\x61\x65\x65\x65\x65\x20/' testfile
foo aeeee baz

# this happends with latest trunk/master:
# bastian@ryzen:~/software/sed$ sed/sed --version
sed/sed (GNU sed) 4.8.7-b352-dirty

I stumpled over this behaviour while
replacing real binary data, where randomly
a 0x24 was involved at the end of the match string

Thanks for reading and maybe fixing 8-)

bye, bastian





reply via email to

[Prev in Thread] Current Thread [Next in Thread]