0

I tried using bbe as below

bbe -e 's/01110011/01111000/' test.txt

All I'm trying to accomplish in this example is to read the file as if it's a binary file, and replacing the letter s with x.

I'm open to alternative solutions, I'm not stuck on bbe

2

To my knowledge, bbe cannot use binary (base 2) patterns directly. Hexadecimal, octal, or decimal work, however:

# Hex:
$ echo 'xs' | bbe -e 's/\x73/\x78/'
xx
# Octal:
$ echo 'xs' | bbe -e 's/\0163/\0170/'
xx
# Decimal:
$ echo 'xs' | bbe -e 's/\115/\120/'
xx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.