Reputation: 29519
perl -pi -e 's|\x20|; s|\x90|' log.bin
gives me this error
Backslash found where operator expected at -e line 1, near "s|\x20|; s|\"
syntax error at -e line 1, near "s|\x20|; s|\"
Execution of -e aborted due to compilation errors.
What am I doing wrong? the line intended to replace all bytes with 0x20 to 0x90...
Upvotes: 0
Views: 219
Reputation: 1620
You have 2 half statements, instead of one complete one. You're probably looking for
perl -pi -e 's|\x20|\x90|g' log.bin
Upvotes: 4
Reputation: 10786
You formatted the s command wrong. Try this:
s|\x20|\x90|g;
The g means global and the formatting is necessary for the command
Upvotes: 1
Reputation: 28089
you have two incomplete substitutions in that command, you say substitute \x20
without specifying what it should be replaced with, then separately say replace \x90
again omitting the replacement. This is a syntax error.
the correct syntax is
s|\x20|\x90|g ;
Upvotes: 1