perl - Transliterate Characters in Hex in Bash -
i have set of hexadecimals d transliterate set of hexadecimals, in example :
x00 -> x20 xb0 -> x20 x21 -> x40 x80-xff -> x20 x22 -> x43
i know can chain sed statements :
sed -i.bak $'s/[\x80-\xff]/\x20/g'
or :
sed -e 's/\x00/\x20/g;s/\xb0/\x20/g'
but there way "break" separate changes line more readable? :
sed -e ' s/\x00/\x20/g; s/\xb0/\x20/g; . . . ' file_in > file_out
if not possible, done perl? thank you.
you can pass multiple expressions (-e
) sed
:
sed \ -e 's/\x00/\x20/g' \ -e 's/\xb0/\x20/g' \ -e 's/\x21/\x40/g' \ -e 's/[\x80-\xff]/\x20/g' \ -e 's/\x22/\x43/g' file_in > file_out
Comments
Post a Comment