LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Replace in file (https://www.linuxquestions.org/questions/linux-newbie-8/replace-in-file-904499/)

elishac 09-22-2011 05:14 PM

Replace in file
 
Hello,

I have a binary file in which I know there is a hex string (xxd myFile | grep b13d4f returns a non empty result, where b13d4f is the string I am talking about.)
How can I replace every occurence (actually there is just one in the file, but just in case) of this hex value with another one?

Thanks.

kbp 09-22-2011 06:47 PM

Something like:

Code:

perl -pi -e 's/\xB1\x3D\x4F/\xDE\xAD\xBE\xEF/' your_file
Tested ok on Fedora...

elishac 09-22-2011 07:30 PM

Thx.


All times are GMT -5. The time now is 08:48 PM.