Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
September 23, 2008, 9:06 am
rate this thread
Using Perl, I want to search for a binary data containing & and
alphabets and replace with another string. I am getting an error as
bash-3.2# echo fsdalf&l91Afjkdf | perl -p -e 's/l91A/l2A/g;'
bash: l91Afjkdf: command not found
+ Done echo fsdalf
My requirement is: I have a binary data which can contain any byte
from 0x00 to 0xFF. I want to search for particular set of characters,
say &A12B and replace it with another set of characters, say &A4B.
Please let me know how to do the same. Thanks in advance.
Re: Replacing binary data containing & using perl in HPUX 11.11
This is not at perl issue, but you shell using the ampersand as part
of it's syntax. You'll have to quote the argument to echo:
$ echo 'fsdalf&l91Afjkdf' | perl -p -e 's/l91A/l2A/g;'